This post is a culmination of many answers combined together. So I want to make sure I understand.
In order to add an mc to the stage from the library, you refer to it by its name in the library. The way all of this is done is:
var someMc:String = "this_mc";
newClass = getDefinitionByName(someMc);
mcAdded= new newClass ();
addChild(mcAdded);
If I wanted to name the mcAdded before its added to the stage would I then use “mcAdded.name = someName” before the addChild?
Here is where things have always been fuzzy. If I wanted to edit the mcAdded after it’s been added to stage, I would:
var someString:String = "mcAdded";
var selectedInstance = getChildByName( someString);
selectedInstance.x = 210;
I’ve had problems with accessing the instances on the stage in the past. It seems the names of MCs I add to the stage via code are usually messed up. Sometimes their called something like “instance 47”. Sometimes [object mcAdded]. How do I fix this so I can guarantee that the names of all future instances are predictable? Is there a better way to handle all of this?
- Log in or join for free to make a comment.


