Skip to main content
Inspiring
April 28, 2015
Question

Changing Color using Identifier in AS2?

  • April 28, 2015
  • 1 reply
  • 347 views

I have a Movie clip of  a simple box, I'm having several of them animate in and out repeatedly. In would be one color, then out then back in with another color.

Is there a way to use the movie clips identifier to change them all at once?

This topic has been closed for replies.

1 reply

Ned Murphy
Legend
April 29, 2015

You could use a loop and change them somewhat all at once... the eye would not be able to detect them being done sequentially at loop speed.   You can either name them all similarly with a numeric sequence (box1,box2,box3,etc) and use bracket notation to loop thru them, or you could place the names in an array and loop thru the array.

for(i=1; i<numBoxes; i++){

     this["box"+i]..... change its color however you plan to

}

OR

var boxes = new Array (box1,box2,box3,etc);

for(i=1; i<boxes.length; i++){

     boxes..... change its color however you plan to

}