Reputation: 525
I'm used to working with AS3, but due to recent events I need to work with AS2, and I'm having trouble with a simple task:
How do I access a MovieClip in AS? I drew something, converted it to a symbol (of type MovieClip) and ticked "Export for ActionScript". I gave it the name "MyMC". now, when I'm in some other MovieClips action, how do I access the MovieClip I drew on stage before?
Upvotes: 0
Views: 2548
Reputation: 15570
If it's an object on the stage you need to give it an instance name using the properties panel, and then you can access it through the _root
property:
_root.myMc.doSomething();
Use of Identifier:
Telling a library symbol to export for actionscript works in a similar way to in AS3. The export name you assign is a name that you use to create an instance of that symbol, using the attachMovie
function:
var myMC:MovieClip = this.attachMovie("instanceName","MyMC",this.getNextHighestDepth());
attachMovie
accepts 3 parameters:
name
property of a DisplayObject in AS3. It is a unique name that you assign to each instance of the symbol you create.getNextHighestDepth
to place it in the highest available depth, same as using addChild
in AS3.Upvotes: 1