PDA

View Full Version : Action scripting to multiple instances


maxmare
10-22-2003, 09:33 AM
Hi all, I am trying to animate a movie clip that repeats 400 times in a scene. They are all in the same layer mask and I am trying to make them animate at the same time when I press a button.
My two problems are that layer masks only use one fill and ignore the rest and that when scripting the button, although I have given the instances the same name it only animates one instance.
Is this so because I am using flash 4 and the newer versions are smarter?
Any ideas appretiated. Cheers

Cyberdigitus
10-27-2003, 05:18 PM
one way would be to give them unique instance names with a number in them and then use a loop on a frameaction

for instance:


function animShapes() {

for (var i=1; i<=400; i++) {

var clipname = "shape" + i + "_mc"

//for 'parametric' animation:
mask_mc[clipname]._x = // do something here
mask_mc[clipname]._y = // do something here

//for some anim that is inside the movieclip:
mask_mc[clipname].play();
}
}


then call this function from a button. the idea is to use array syntax to acces instances.

give a yell when you need more explanation.

another way would be to put the animation code inside the movieclips, referencing themselves, and acting when you pushing the button (you can call them all through a loop like above or using listeners and ASbroadcaster.)

Oh, damn, you're using flash 4... not sure if this will work. I'd seriously consider upgrading if you can

CGTalk Moderation
01-16-2006, 11:00 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.