View Full Version : playing exit animation before a mc is about to play...

08-16-2004, 08:01 PM
forgive me if this is a simple question... i'm still alittle new to all this.

i've got 3 movie clips that run after their respective buttons are clicked.

if mc3 is currently running, and the user clicks on button 2... how to i tell
flash to play the exit animation on mc3 before the mc2 plays?

i basically just want one movie clip at a time to play. so if the user has already has mc1 playing, then decides to click on button 2 it will play the
current mc exit animation, and just proceed with mc2.

i know i could send the play head over to the exit animation straight away,
but if i put that into all my buttons then they would all be playing at the
same time. i need to identify which movie clip is currently playing, and have
only that movie clips exit animation play before the other mc begins.

hope i've described this ok. any information about this would be greatly

thanks in advance.

08-16-2004, 08:17 PM
you need to send a variable to the root telling where the user is now. so if the user clicks on button 1

do something
_root.currentLocation = "mc1";

This way on the next button clip you can check what this equals and unLoadMovie of loadMovie by if statements of whatever.

That is a simple way to explain it, it can get very involved, just matter how crazy you want to get.

08-17-2004, 04:06 PM
how would i know which button the user has clicked on.

maybe i don't understand what you are saying.

can i code it to where no matter what the user clicks on... flash already
knows which one of the movie clips are currently playing?

i'm thinking an if/else would work. that is if i knew how to do if/else statements.

each of the movie clips that upon playing will stop at a certain frame number.
each movie clips stop frame is a different number. for example:
mc1 stop(10)
mc2 stop(20)
mc3 stop(30)

so... is it possible to put if/else code under the buttons on (release)?
for example: lets say button3 is clicked.

on (release) {

if currentMovie frame number = (10)
play currentMovie out animation.

this is what i would like to do, but for each button have 3 different if/else statements so no matter what... flash will check to see where the play head is and then play the corresponding out animation for that movie clip.

just don't know how to get started.

08-17-2004, 04:20 PM
yes you can put an if statement almsot anywhere.

flash would know what mc is playing by defining the a variable like I said in my previous post.

if the user clicks to play mc1 then on that button to make mc1 play you define a root varaible.
_root.currentMovie = "mc1";

Now flash is playing movieClip1 and also you have a variable at root so AS will know what mc is playing. so now you can do

if(currentMovie == "mc1"){
go do this

you would define the currentLocation on every button that loads a new mc and change the value of currentLocation to match that mc instance name. After you defining what currentMovie is you can write your if statement:

if(currentMovie._currentFrame == 10){

movieOut would be the framelabel of the start of your movie out animation.

Doing it this way makes it so you can either have the exact same code on all your buttons or if you get more into AS you can have one button and dynamically load it into several places. Ofcourse you would have to make mc3.play(); a variable also to do any of that.

I try to hardcode asleast as possible, which is why I am saying make currentMovie be the same as your mc instance name instead of hardcoding your mc instance name in. I define variables that way any hardcoding is in the root actions and you don't have to go digging thorugh your fla to find where things are messed up.

I hope that makes sense. :confused:

08-17-2004, 07:03 PM
thanks for explaining it that way...

i appreciate it. things are really starting to make sense now.

you rock man!