Skip to main content
Participant
September 15, 2022
Answered

Go to Scene and Play does not play to the next scene

  • September 15, 2022
  • 1 reply
  • 217 views

Hi, I am a  newbie in Adobe An. I am now working on an interactive project. The problem I face is that went I add an actions code (gotoAndPlay) to a button in Scene 1 and wish to lead it to Scene 2, it just will replay Scene 1 went I press it. (Test Movie In AIR(mobile) )

 

This is the code I use for my button:

 

start.addEventListener(MouseEvent.CLICK, fl_ClickToGoToScene_2);

function fl_ClickToGoToScene_2(event:MouseEvent):void
{


MovieClip(this.root).gotoAndPlay(1, "Scene 2");
}

 

Thank you so much! 

    This topic has been closed for replies.
    Correct answer JoãoCésar17023019

    Hi.

     

    This is probably happening because you have only one frame in "Scene 2". Try:

    - Adding more frames to the target scene;

    - Using gotoAndStop instead;

    - Or stopping the scene you're navigating to.

     

    Pleaset let us know.

     

    Regards,

    JC

    1 reply

    JoãoCésar17023019
    Community Expert
    JoãoCésar17023019Community ExpertCorrect answer
    Community Expert
    September 15, 2022

    Hi.

     

    This is probably happening because you have only one frame in "Scene 2". Try:

    - Adding more frames to the target scene;

    - Using gotoAndStop instead;

    - Or stopping the scene you're navigating to.

     

    Pleaset let us know.

     

    Regards,

    JC

    Participant
    September 15, 2022

    A million thanks!!!! Yes, its really just because I had only one frame in Scene 2. I try adding " stop(); " , and it works!! Thank you very much!!! 😊

    JoãoCésar17023019
    Community Expert
    Community Expert
    September 15, 2022

    Fantastic! You're welcome!