# CS3 AS2 playtoAndStop

**URL:** <https://forum.kirupa.com/t/cs3-as2-playtoandstop/260140>\
**Category:** flash\
**Created:** [May 12, 2008, 10:35pm UTC](https://forum.kirupa.com/t/cs3-as2-playtoandstop/260140 "2008-05-12T22:35:47Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![ericvecchi](https://avatars.discourse-cdn.com/v4/letter/e/6bbea6/32.png) [@ericvecchi](https://forum.kirupa.com/u/ericvecchi)\
**Post date:** [May 12, 2008, 10:35pm UTC](https://forum.kirupa.com/t/cs3-as2-playtoandstop/260140/1 "2008-05-12T22:35:47Z")

</div>

[SIZE=1]Hello everyone. I am hoping some genius flash guru can help me out. I am trying to get a movie clip to play to a certain frame and stop at that frame. I have multiple buttons that I am using to stop along different frames of the timeline. The timeline has a nifty animation of a plunger of a syringe going down to different intervals. So I can’t use the standard “stop();” command on the frame itself. If you open the attached file it might be more clear.  
What I think I need is a loop that will say If currentFrame is not equal to XFrame play(); If currentFrame is equal to XFrame stop();.  
Or does AS2 have a command for playtoAndStop. Instead of gotoAndStop or gotoAndPlay?  
Any help is greatly appreciated. Thanks!

Here is my code:  
[SIZE=1]syringe2.stop()  
syringe2.d1.onRelease = function () {  
if(syringe2.currentFrame \< 47)  
syringe2.play()  
if(syringe2.currentFrame = 47)  
syringe2.stop()  
}

/\*  
I want to replace the below code with the gotoAndPlay code for each button. d2, d3, d4 ect.  
\*/

syringe2.d2.onRelease = function () {  
syringe2.gotoAndStop(43)  
}  
syringe2.d3.onRelease = function () {  
syringe2.gotoAndStop(39)  
}  
syringe2.d4.onRelease = function () {  
syringe2.gotoAndStop(35)  
}  
syringe2.d5.onRelease = function () {  
syringe2.gotoAndStop(31)  
}  
syringe2.d6.onRelease = function () {  
syringe2.gotoAndStop(26)  
}  
syringe2.d7.onRelease = function () {  
syringe2.gotoAndStop(22)  
}  
syringe2.d8.onRelease = function () {  
syringe2.gotoAndStop(18)  
}  
syringe2.d9.onRelease = function () {  
syringe2.gotoAndStop(13)  
}  
syringe2.d10.onRelease = function () {  
syringe2.gotoAndStop(9)  
}  
syringe2.d11.onRelease = function () {  
syringe2.gotoAndStop(5)  
}  
syringe2.d12.onRelease = function () {  
syringe2.gotoAndStop(1)  
}  
[/SIZE][/SIZE]
