# IF / ELSE IF / \_currentframe / Playhead Location

**URL:** <https://forum.kirupa.com/t/if-else-if--currentframe-playhead-location/55992>\
**Category:** Uncategorized\
**Created:** [June 29, 2004, 6:47pm UTC](https://forum.kirupa.com/t/if-else-if--currentframe-playhead-location/55992 "2004-06-29T18:47:46Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![jaredburns](https://avatars.discourse-cdn.com/v4/letter/j/43a26b/32.png) [@jaredburns](https://forum.kirupa.com/u/jaredburns)\
**Post date:** [June 29, 2004, 6:47pm UTC](https://forum.kirupa.com/t/if-else-if--currentframe-playhead-location/55992/1 "2004-06-29T18:47:46Z")

</div>

I am having difficulty determining where the playhead is located in the timeline. Let me give you an idea of what I am trying to accomplish. I have 3 buttons. onRelease the playhead will go to a specified frame depending on the current location of the playhead.

See if this image helps.

![](http://clearchannelsatellite.com/_jjb/flash.jpg)

Basically what will happen is this.

1. If button 1 is clicked, if the playhead is at frame 1 (“B1”), nothing will happen, if the playhead is at frame 6 (“B2”), it will gotoAndPlay(“2to1”), if the playhead is at frame 11 (“B3”), it will gotoAndPlay(“3to1”).

2. If button 2 is clicked, if the playhead is at frame 6 (“B2”), nothing will happen, if the playhead is at frame 1 (“B1”), it will gotoAndPlay(“1to2”), if the playhead is at frame 11 (“B3”), it will gotoAndPlay(“3to2”).

3. If button 3 is clicked, if the playhead is at frame 11 (“B3”), nothing will happen, if the playhead is at frame 1 (“B1”), it will gotoAndPlay(“1to3”), if the playhead is at frame 6 (“B2”), it will gotoAndPlay(“2to3”).

After it plays, there is a gotoAndStop action to go to the appropriate frame, B1, B2, or B3.

The following script is how I had hoped to achieve this, but its obviously not working. It is located on layer actions\_btns.

button1\_btn.onRelease = function () {  
if (\_currentframe = 1) {  
gotoAndStop(“B1”);  
} else if (\_currentframe = 6) {  
gotoAndPlay(“2to1”);  
} else if (\_currentframe = 11) {  
gotoAndPlay(“3to1”);  
}  
}  
button2\_btn.onRelease = function () {  
if (\_currentframe = 6) {  
gotoAndStop(“B2”);  
} else if (\_currentframe = 1) {  
gotoAndPlay(“1to2”);  
} else if (\_currentframe = 11) {  
gotoAndPlay(“3to2”);  
}  
}  
button3\_btn.onRelease = function () {  
if (\_currentframe = 11) {  
gotoAndStop(“B3”);  
} else if (\_currentframe = 1) {  
gotoAndPlay(“1to3”);  
} else if (\_currentframe = 6) {  
gotoAndPlay(“2to3”);  
}  
}

Please help!!!

Chow!
