简体   繁体   中英

How to use objects and symbols in an external file in Flash AS3?

I am trying to convert all my code that is in the timeline in the Movement.fla file into code for an external file name Main.as for Flash CS6 AS3. I have no idea how to reference the objects on the stage or the symbols in the library of Movement.fla from Main.as.

Can someone show me how to reference objects and symbols through an external file? The inclusion of some pseudo code would also be preferable.

Display objects on stage can be referenced by giving them an instance name on object's properties. Once an object has instance name your calls can be like this.

instanceName.play();
stage.addChild(instanceName); // and soo on...

Also some objects might only exist at some point in the timeline, if your previous code was at the same point in the timeline then this could be the reason why is not working as external. Make sure your objects always exist and not only in some frames.

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