我有一些 Flash 代码来模拟移动的云。它在 AS1 下工作,现在我已将 FLA 文件更新为 AS3 和最低 Flash 版本 10。这段代码有什么问题?你能帮忙看看这个功能有什么问题吗?
function createLiquidFlow(target)
{
target.counter = 1;
target.pt = new flash.geom.Point(0, 0);
target.mpoint = new flash.geom.Point(0, 0);
// target.myBitmap = new flash.display.BitmapData(target._width, target._height, false, 0);
target.myBitmap = new flash.display.BitmapData(target.width, target.height, false, 0 );
target.myDispl = new flash.filters.DisplacementMapFilter(target.myBitmap, target.mpoint, 10, 2, 10, 15, "clamp");
target.myList = new Array();
target.myList.push(target.myDispl);
target.filters = target.myList;
target.addEventListener(Event.ENTER_FRAME,
function ()
{
trace("target.name = "+target.name);
trace("target.myBitmap = "+target.myBitmap);
trace("target.myBitmap.width = "+target.myBitmap.width);
trace("target.myBitmap.height = "+target.myBitmap.height);
trace("target.counter = "+target.counter);
var filterList = target.filters;
var offset = new Array();
offset[1] = new Object();
offset[1].x = target.counter;
offset[1].y = target.counter / 2;
target.myBitmap.perlinNoise(45, 6, 3, 50, true, false, 7, true, offset);
filterList.mapBitmap = target.myBitmap;
target.filters = filterList;
++target.counter;
});
}
createLiquidFlow( movieClipLiquid )
我可以跟踪事件侦听器,但位图和 Perlin 函数似乎不起作用。输出 SWF 中没有视觉上发生任何事情。TIA
target.name = liquid74_mc
target.myBitmap = [object BitmapData]
target.myBitmap.width = 950
target.myBitmap.height = 76
target.counter = 1
myFilterList = [object DisplacementMapFilter]
BEFORE myFilterList.mapBitmap = undefined
AFTER myFilterList.mapBitmap = [object BitmapData]
BEFORE target.filters = [object DisplacementMapFilter]
AFTER target.filters = [object DisplacementMapFilter]
target.name = liquid74_mc
target.myBitmap = [object BitmapData]
target.myBitmap.width = 950
target.myBitmap.height = 76
target.counter = 2
myFilterList = [object DisplacementMapFilter]
BEFORE myFilterList.mapBitmap = undefined
AFTER myFilterList.mapBitmap = [object BitmapData]
BEFORE target.filters = [object DisplacementMapFilter]
AFTER target.filters = [object DisplacementMapFilter]