开发者

Duplicating movie clips in AS3

开发者 https://www.devze.com 2023-02-18 10:27 出处:网络
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).

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

精彩评论

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

关注公众号