简体   繁体   中英

How to access a graphic that has been added to the stage in Adobe Flash Pro (CS5)

我在舞台上添加了一个图形,我需要从动作脚本中访问它,知道怎么做吗?

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM