[Previous] [TOC] [Next]

Link a button to a scene


Now that the playhead stops at Frame 1, you'll add ActionScript that takes the user to Scene 2 upon releasing the goScene_btn instance.

  • Press Enter (Windows) or Return (Macintosh) twice and type the following comment. Then write the function that takes users to Scene 2 upon release of the goScene_btn instance:

    // This script takes the user to Scene 2 when goScene_btn
    
    // is released.
    
    goScene_btn.onRelease = function (){
    
      gotoAndStop("Scene 2", 1);
    
    };
    

    In the script that you just typed, you used the onRelease() method for the button object. The gotoAndStop() function is a timeline control function that lets you specify the scene and frame number. In this case, you specified Frame 1.

[Previous] [TOC] [Next]