-
Restart button issue
I have created a timeline with a single play button. When pressed, the button will gotoAndPlay a specific frame (play frame x, stop at frame y). Once the timeline reaches the last frame I want the next press of the button to take you back to the start and have the ability to run through the timeline as before. The problem is, attaching a gotoAndPlay(1); on the last press will take you back to frame 1 but the play button no longer works.
Everything I have is on the main timeline. I can't figure out why the button only works for one round.
-
.
Hi,
how do you have the button working, is it,
on the button like so
PHP Code:
on (press) { play(); }
or on the timeline like so
PHP Code:
button.onPress = function(){ play(); }
or attach your file
Last edited by fruitbeard; 02-20-2013 at 11:22 AM.
-
.
Hi,
Anyway, perhaps you can try something like so
PHP Code:
button.onPress = function() { if (_currentframe == 1) { play(); } else if (_currentframe == _totalframes) { gotoAndStop(1); } };
effectively it disables the button until its either on frame 1 or the last frame
-
The code I'm using:
forbtn.addEventListener(MouseEvent.MOUSE_UP, gostart);
function gostart(Event:MouseEvent):void
{
gotoAndPlay(1);
}
This will rewind the scene back to frame 1 but the button will lose all functionality the second time through.
-
.
Hi,
Sorry, AS3, although my little test works fine with your code
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|