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.
Basically what will happen is this.
-
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”).
-
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”).
-
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!