Play until a specific frame and stop

how would i do this using actionscript?
i was kind of thinking like this:

onClipEvent(enterframe){
if(thecurrentframe=2){
stop();
}
}

but im not completely sure. what variable would the currentframe part be in??

Right click on the frame you want the movie to stop on, hit actions and just use stop()

well, the frame i want it to stop at will change depending on what the user clicks on… so i think i would have to use actionscript, right? since the conditional statement is actionscript, u would have to use actionscript to test the variable…

Well what about a gotoAndStop(frameNumber) action?

What are you trying to do, knowing that might help with the solution.

does go to and stop play through the until the stop number? i thought it just jumped to the specified frame…

when a user clicks a button,i want the animation to play and then stop at a specified frame…

i think the script i noted above will work once i figure out how to tell the frame is currnetly on…

What you need to do is create a movieclip that has the animation that you want in it and then place a stop action on the first frame of that movieclip. Then label the frame that you want the animation to start at and put a stop action and the frame that you want the animation to stop at. You can then just attach some code to your button like:

on(release){
_root.animation.gotoAndPlay(“start”);
}
that should solve your problem and remember to give an instance name, this should through your animation rather then just going to a specific frame. You could also just make the animation on the main timeline and do the same procedure, it will work the same way.

Hope this helps

Kyle:)

thanx a lot, but when the user clicks another button, i want it to stop at another place. u can download my flash file thingy at http://www.vip3r.com/temp/navigator.fla
and then u can c what im talking about…
up there where the selctor layer is, i want the selector object to move to cover the button clicked on…
thanx again :slight_smile:

your fla is corrupted my machine wont’ open the file…

Kle

i’ll send u the file, wuts ur email?
if u don’t feel like putting it on the forums, just email me:
[email protected]
and i’ll reply with the file
thanx!!

viper,

your original code is only a few characters away from working:


onClipEvent(enterframe){
   if(_currentframe==2){
      stop();
   }
}

wow, thats pretty close :slight_smile:
thanx for helping :slight_smile: