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 );
精彩评论