views:

27

answers:

1

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));
A: 

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 );
PatrickS
this is what i need, thank you.
Darwin