Hopefully this should be a quick question. I'm having trouble accessing some movie clips in my library dynamically using an array.
Basically, my array holds a bunch of letters..
var monarray:Array =("AAACBCBCAABBC").split("");
Now, my library holds three movie clips. They have the following AS3 linkage: monsterA monsterB monsterC
What I want to do is create a new instance of an object based on where I am in the array.. For example, when monarray is at index [0], I want monsterA to be added..
This is the code I am using to try and achieve this effect:
var b = new monster[monarray[i]];
b.x = mouseX;
b.y = mouseY;
addChild(b);
i ++;
However, upon compiling my .swf, I get this error:
Scene 1, Layer 'Layer 1', Frame 1, Line 9 1086: Syntax error: expecting semicolon before leftbracket.
I understand this is because I'm obviously not doing it right, but I've only ever used arrays to call up a specifically-indexed instance.
I'm sorry if this is noobish, but I'm not quite sure how I can dynamically choose between these three library instances on the go!
Thanks a lot in advance!
Harry.
trace(monarray[i]);what do you get