I come from a Lingo - AS2 scripting background and am trying to get a handle on AS3 and how it uses classes.
I've always relied on concatenating strings to reference a series of objects.
I've exported a series of movie clips as classes and want to reference them in the document class.
The following works as expected.
_ballname = new SLD_5;
mcP1.setType(_ballname); // is another class method
But I like to use a 'for' loop to create the series of 15 movies cause it's easier to make changes. When I try to put the above in a for loop with something like
for (var i:Number = 1; i < 15; i++)
_ballname =("SLD_" + i);
_balltype = new (_ballname)();
("mcP" + i).setType(_balltype);
I get errors like "Instantiation attempted on a non-constructor " where ever I try use the concatenated string.
Sorry this is so long. Thanks for taking time to read.