Skip to main content
Known Participant
February 24, 2010
Question

GotoAndPlay going to the wrong frame

  • February 24, 2010
  • 1 reply
  • 1441 views

Hi,

I am trying to create a Play Again button on my game. When the game finishes a menu comes up on the screen with a play again button. The menu is created using a class and the button event is created and handled in the actionscript in the current frame. The button event handler makes a call to gotoAndPlay(currentFrame, "scene").

Whenever the button is pressed however it takes me to the next frame, for example if the current frame is 3 it will show frame 4. Usually the button is removed from the stage when the button is clicked but if i disable that and the button remains, you can click on it again and it it will take u to the correct scene, and again will take you to the next scene and back again and so on... I am completely at a loss to why, so any ideas would be appreciated.

Thanks

This topic has been closed for replies.

1 reply

kglad
Community Expert
Community Expert
February 24, 2010

does it really make sense to goto that frame?


is the scene where the button appears named "scene"?  or, is that a different scene?

Emma87Author
Known Participant
February 24, 2010

going to the frame will restart the animation on that frame which is what i want. either do it that way or restart the frame somehow. not sure how. There is only one scene called "Activities", so all i am trying to do is reload a frame.

kglad
Community Expert
Community Expert
February 24, 2010

don't you see an error message from flash about Scene scene not being found?

anyway, label the frame you want to goto and use that label:

gotoAndPlay("restart");