I really have searched high and wide and i'm starting to think it may be my terminology that is preventing me from finding the answer.
I have a MovieClip in my library set to Export to ActionScript 3.0 with a Class called 'Info_Win' (its basically going to be a pop-up window, the contents of which depends on it's instance name).
I will be adding a given number of these MovieClips to the main stage and each one has to be given a custom instance name that will allow me to access it once it's on the stage (an array lays out the instance names). As previously stated, the Movieclip Instance name will then define what the contents of the pop-up window will be.
Here is the array:
static public var informationWindows:Array = new Array(
{_informationName:"iwPanelDescription", _popupType:"3"},
{_informationName:"iwHelpConsole", _popupType:"2"},
{_informationName:"iwExampleInstanceName", _popupType:"1"}
);
Running through the array and returning the _informationName should be straightforward.
Where I am tripping up is actually controlling the name of the MovieClip Instance names. In AS2 I would have wrapped an eval() argument around the left hand side of the argument.
I am using the following code: to create add the clips but this is no good:
var info_win:Info_win = new Info_win();
addChild(info_win);
info_win.name = "iwPanelDescription";
From here, if I can get the instance name issue sorted then I can use a simple for loop to access the array I have created and set the instance name up dynamically.
Have tried things like this but with no joy:
var mcName:String = "iwPanelDescription";
var this[mcName]:Info_win = new Info_win();
addChild(this[mcName]);
Anything that can be done to help would be most gratefully received!
What is the problem with
From here, if you need the
iwPanelDescription
movie clip, you can just go ahead andAnd you're done.
Solved...
Simulator Class...
simulator_constants Class...
Info_win Class...
Have you considered storing your own reference vs relying on the stage?
You could do this easily like so:
And to expand on how this could be used with your
informationWindows
array:If you wanted to create these instances dynamically you can use
getDefinitionByName()
like so: