开发者

Actionscripts 3 Clone MovieClip

开发者 https://www.devze.com 2023-01-22 03:24 出处:网络
How do we clone a copy of an \"Instance name\"?Thanks guys //The test_close is an instance name which I drew on the canvas.

How do we clone a copy of an "Instance name"? Thanks guys

//The test_close is an instance name which I drew on the canvas.

var cloneMe:MovieClip = new MovieClip();
cloneMe.graphics.copyFrom(test_clone.graphics); //here is my clone codes开发者_如何学编程
addChild(cloneMe);
trace(cloneMe.getBounds(cloneMe));


If you simply need a copy of the object that has been drawn, use the BitmapData draw method.

var bmd:BitmapData = new BitmapData(cloneMe.width , cloneMe.height );
bmd.draw( cloneMe);
var bm:Bitmap = new Bitmap(bmd);

// not relevant, simply shifting the new Bitmap so that it is visible
bm.x = 10;
bm.y = 10;
addChild( bm );
0

精彩评论

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