Skip to main content
Inspiring
September 6, 2024
Question

the action for scenes instead of frames

  • September 6, 2024
  • 1 reply
  • 120 views

hello there

i am using this code for multiple buttons in the same frame, the inicial frame, in order to jump to any other frame when i press the button...

button_name.addEventListener(MouseEvent.CLICK, launch_button1);
function launch_button1(event:MouseEvent):void
{
gotoAndPlay(1); // plays the current timeline from Frame 1 of Scene 1
}

is there an action for instead of going to frame to go to the scene......an action for scenes similar to this ?

 

 

also about the home button

whats the action script for home button to come back to the first scene?

anyone?

    This topic has been closed for replies.

    1 reply

    JoãoCésar17023019
    Community Expert
    Community Expert
    September 6, 2024

    Hi.

     

    Just add the scene name as the second paramater of the gotoAndPlay or gotoAndStop methods.

     

    gotoAndPlay(1, "Scene 2");

     


    The names of the scenes must be the ones you see in the Scene panel.


    For the home button, you would pass 1 as the frame and the name of the first scene.

    Regards,
    JC