How to access a graphic that has been added to the stage in Adobe Flash Pro (CS5)
I added a graphic to the stage and I need to access it from actionscript开发者_C百科, any idea how to do that?
You need to convert your graphic to a MovieClip:
- Click on your graphics
- Press F8
- Click OK
- Click on the newly created MovieClip, then assign an instance name to it in the Properties dialog
You can then access the MovieClip from ActionScript.
Edit:
To convert the graphic to a BitmapData, just use the draw
function:
var bmpData:BitmapData = new BitmapData(yourMc.width, yourMc.height);
bmpData.draw(yourMc);
var bmp:Bitmap = new Bitmap(bmpData);
addChild(bmp);
精彩评论