Arrays: using for loop and onPress
Im not very good with arrays. Here is my broken code:
//Create array with 4 movieclips
var invArray:Array = new Array("i_greenLine", "i_orangeDot", "i_yellowBlock", "i_brownThing");
//repeat this code for every item (+1)
for (i=0; i<invArray.length; i++) {
trace(invArray);
//Outputs:
//i_greenLine
//i_orangeDot
//i_yellowBlock
//i_brownThing
invArray.onPress = function() {
trace("hit");
};//the movieclips are not clickable.
}
Is there a way to get the movieclips on the stage to be clickable via an array? There will be lots and lots of movieclips.
help?
thanks?