Beginner question - Arrays and for loops

good day gentlemen, and ladies.

This is fairly simple to most of you, but it will revolutionize my flash experience once i can get past this.

I’d like to add event listeners to movieclips ( already on the stage ), whose names are called from an array one by one, into a for loop.



// there are 4 movielcips on the stage with name a1 - a4.
 
 // create array 
 var Bro:Array = ["a1","a2","a3","a4"];
 
 // for loop
 for ( var i:Number = 0; i < 4; i++) {
 
     // Add event listener to array values to buttons.
     Bro*.addEventListener(MouseEvent.ROLL_OVER, roll, false, 0, true);
     
     //execute this function on rollover
     function roll() {
         trace("why wont my arrays work in for loops");
     }
 }


  • peace and love from New York City