开发者

Duplicating movie clips in AS3

Say I have a movieclip called mcLoader a开发者_如何学编程nd within it I have some loaded bitmap image (don't know the name, it's dynamically loaded).

How do I copy that bitmap image into a movieclip mcContainer?


The following code will copy every content of mcLoader and put it in mcContainer:

import flash.display.BitmapData;
import flash.display.Bitmap;

for (var i:int = 0; i < mcLoader.numChildren; i++)
{
    var obj = mcLoader.getChildAt(i);
    var bmd:BitmapData = new BitmapData(obj.width, obj.height);
    var bm:Bitmap = new Bitmap(bmd);
    bmd.draw(obj);

    mcContainer.addChild(bm);
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜