有保存读取悔棋功能的五子棋
制作拖动鼠标产生水纹动画的制作
1、导入一张合适的图片到库中
2、在库中刚导入的图片上点击右键。点击“链接”,再按下图设置链接属性。
3、新建一个空影片剪辑元件,且将其放入主场景中,命名为:mcaa.
4、在主场景第一帧写上如下代码:
var surface1 = flash.display.BitmapData.loadBitmap("surface",0);
var bounds = new flash.geom.Rectangle(0, 0, 456, 356);
var origin = new flash.geom.Point();
var matrix = new flash.geom.Matrix();
var matrix2 = new flash.geom.Matrix();
matrix2.a = matrix2.d = 2;
var wave = new flash.filters.ConvolutionFilter(3, 3, [1, 1, 1, 1, 1, 1, 1, 1, 1], 9, 0);
var damp = new flash.geom.ColorTransform(0, 0, 9.960937E-001, 1, 0, 0, 2, 0);
var water = new flash.filters.DisplacementMapFilter(result2, origin, 4, 4,48,48);
attachMovie("mcaa","mcaa",-1700)
//mcaa._width=456
//mcaa._height=356
//var mcaa:MovieClip = this.createEmptyMovieClip("mcaa",0);
mcaa.attachBitmap(output, 0)//this.getNextHighestDepth());
//attachBitmap(output, 0);
var ms = getTimer();
var frame = 0;
var mouseDown = false;
onMouseDown = function ()
{
mouseDown = true;
};
onMouseUp = function ()
{
onEnterFrame();
mouseDown = false;
};
onEnterFrame = function ()
{
if (mouseDown)
{
var _loc2 = _xmouse / 2;
var _loc1 = _ymouse / 2;
source.setPixel(_loc2 + 1, _loc1,;
source.setPixel(_loc2 - 1, _loc1,;
source.setPixel(_loc2, _loc1 + 1,;
source.setPixel(_loc2, _loc1 - 1,;
source.setPixel(_loc2, _loc1,;
} // end if
result.applyFilter(source, bounds, origin, wave);
result.draw(result, matrix, null, "add");
result.draw(buffer, matrix, null, "difference");
result.draw(result, matrix, damp);
result2.draw(result, matrix2, null, null, null, true);
output.applyFilter(surface1, new flash.geom.Rectangle(0, 0, 456, 356), origin, water);
buffer = source;
source = result.clone();
};
updateAfterEvent();
主场景第二帧代码
fscommand("allowscale", "false");
_bu=1
_root.plabu=1
主场景第三代码
l1 = _framesloaded;
l2 = _totalframes;
if (l1 == l2)
{
gotoAndPlay(10);
} // end