PDA

View Full Version : Better way to do it???



Uli
March 9th, 2005, 02:40 PM
Hello there,
Here's what i'm doing and i was wondering if there's a better way to do it. Let's pretend i have 10 MovieClips and 1 prototype function...
Now to assign the function to each MC i go:
MC1.myproto();
MC2.myproto();
(...)

Is there a better way to add this "behavior" to all the MC i want to? Like a Class (i guess?) or something?

TiA :)

mpelland
March 9th, 2005, 02:50 PM
for (i =1; i<11; i++) {
_root["MC"+i].myproto();
}

Uli
March 9th, 2005, 03:02 PM
Well yea i thought about that but i was looking for a more dymanic way cause my movieclips could not be named the same way, and i could have a different number of MC for each type of MC...

mpelland
March 9th, 2005, 03:15 PM
you could build an array of the movie clip names as create the movie clips. then loop through that