0
votes

I'm creating a animation with two scenes. One and two, from the first scene the gotoandPlay from frame 1 to 2, to start the animation works. I working on the function from frame 121 to return to frame 1 and allow the user to replay scene one on click of the same play button to start again. But it doesn't work. Any help would be great. Thanks everyone.

Scene 1

stop();
btn_next.addEventListener(MouseEvent.CLICK, fl_ClickToGoToAndPlayFromFrame_3);
function fl_ClickToGoToAndPlayFromFrame_3(event:MouseEvent):void
{
gotoAndPlay(2);
}

Scene 2

stop();
btn_return.addEventListener(MouseEvent.CLICK,fl_ClickToGoToAndStopAtFrame_2);
function fl_ClickToGoToAndStopAtFrame_2(event:MouseEvent):void
{
gotoAndStop(1);
}
1

1 Answers

0
votes

This is my guess:
In your first instance, the gotoAndPlay(2) goes to frame 2 of scene 1, which doesn't exist, so the playhead progress to the following scene.

In the second instance, the gotoAndStop(1) goes to frame 1 of scene 2, which does exist, so the playhead goes there and stays there.

Possible solution:
you might want to use the gotoAndPlay(1, "scene 1") syntax, which should fix your problem. Also you might want to skip scenes altogether to avoid these headaches ...