How to Change Between Scenes in AS3

Written by mark stansberry
  • Share
  • Tweet
  • Share
  • Pin
  • Email
How to Change Between Scenes in AS3
Change between Flash movie scenes with just one line of AS3 code. (Photos.com/AbleStock.com/Getty Images)

Scenes help you organise large flash animation projects and can be reused throughout your animation project. Controlling the scene sequencing with ActionScript 3 (AS3, the Flash programming language) makes working with scenes even easier. With just a line of AS3 code you can instantly play a different scene. Using scenes in Flash is not just used to improve productivity, but as an easy way to interject commercials or interactive pauses. Because of Flash's video capabilities, you can interject a video scene for a real commercial effect or a questionnaire to find out what viewers are thinking.

Skill level:
Moderate

Other People Are Reading

Things you need

  • Adobe Flash Professional: CS3, CS4 or CS5 versions.

Show MoreHide

Instructions

  1. 1

    Start Flash Professional. Click "Flash File (ActionScript 3.0)" from the splash window to create a new file for an AS3 Flash animation project.

  2. 2

    Click "Scene" from the Insert menu to create a new scene. Create an animation in this scene. Click "Scene" again from the Insert menu to create another animation in this scene. Continue creating scenes for your movie in a similar fashion.

  3. 3

    Click "Scene" from the "Other Panels" menu within the Window menu to display the Scene Panel. Note that he name of the three scenes created have been automatically named in the Scene Panel as "Scene 1," "Scene 2" and "Scene 3."

  4. 4

    Click the "Scene 1" icon in the Screen Panel to display the contents of Scene 1 on the stage. Click "Timeline" in the Window menu to display the timeline for Scene 1. Insert a blank keyframe on the frame before the last frame on Scene 1's timeline. Position your mouse cursor over the blank keyframe you created and click your mouse button to select the keyframe.

  5. 5

    Open up the Actions Panel and type on the first line of the ActionsScript 3 editor the code:

    gotoAndPlay(1,"Scene 2");

    This will instruct Flash to start playing the Scene 2 beginning at frame 1 on the Scene 2 timeline when Scene 1 reaches its last frame.

  6. 6

    Click the "Scene 2" icon in the Screen Panel to display the contents of Scene 2 on the stage. Click "Timeline" in the Window menu to display the timeline for Scene 2. Insert a blank keyframe on the frame before the last frame on the Scene's 2 timeline. Position your mouse cursor over the blank keyframe you created and click your mouse button to select the keyframe.

  7. 7

    Open up the Actions Panel and type on the first line of the ActionsSript editor the code:

    gotoAndPlay(1,"Scene 3");

    This will instruct Flash to start playing the Scene 3 beginning at frame 1 on the Scene 2 timeline when Scene 2 reaches its last frame.

  8. 8

    Repeat the procedure for scene 3, but enter the following code in the last frame, so that your Flash animation will continually loop through scenes 1, 2 and 3 -- in that order:

    gotoAndPlay(1,"Scene 1");

Tips and warnings

  • You can place the code to instruct Flash to go and play another scene starting at any frame location on any frame on any other scene's timeline -- and go to another scene and stop playing at a specific frame location. You can also give your scenes different screen names by double-clicking on the screen name icon in the Screen Panel.
  • The playing of scenes in Flash is controlled with AS3 code in the other scenes. If you don't include an AS3 code statement to instruct Flash to play another scene within a scene frame, the Flash movie will just continually play the first scene and none of the other scenes. If you select Play and Play All Scenes from the Control menu, all scenes will play in test mode -- but will not be played in your final published movie.

Don't Miss

Filter:
  • All types
  • Articles
  • Slideshows
  • Videos
Sort:
  • Most relevant
  • Most popular
  • Most recent

No articles available

No slideshows available

No videos available

By using the eHow.co.uk site, you consent to the use of cookies. For more information, please see our Cookie policy.