Section 5.4. Using Scenes

5.4. Using Scenes

Scenes provide a way to organize large files or animations into multiple timelines. This makes it easier to view smaller sections at a time, without having to scroll endlessly. For example, you may have a large linear animation that is organized into chapters. Such a file may be easier to work with if you separate each chapter into its own scene. Similarly, you may have a story-driven game with levels that are separated by animations that further the story. In this case, each level and animation might be placed into its own scene.

To add Scenes, use the Insert Scene menu command. Scenes can be given descriptive names to make it easier for you to distinguish one from another. To switch between scenes in authoring mode, use the Edit Scene menu in the upper-right corner of the main document window, as seen in Figure 5-13.

Figure 5-13. Use the Edit Scene menu to switch scenes and timelines.

Alternately, you may use the Scene panel (Window Other Panels Scene) to accomplish all of these tasks. It lists all current scenes, allowing you to click once to switch scenes, or double-click to rename a scene. In addition to adding scenes in this window, you can also delete and even duplicate sceneshandy when the bulk of a timeline remains intact and only subtle changes are required in the new scene.

5.4.1. Scripting Scene Changes

At runtime, a movie with multiple scenes behaves just like a movie with one long timeline. For example, if you test the movie you just created, you will see the two pages from the PDF flashing back and forth, just as if they were side by side in keyframes.

Adding scene navigation is as simple as adding frame navigation:

  1. Continue with the file you created earlier, when importing the editorial.pdf file.

  2. Create a button in the lower-right corner of each scene that you can use to switch between them. If you prefer, open the provided pdf_ scenes_01.fla in the /05/Importing Vectors folder, which already has buttons included.

  3. In Scene 1, give the button an instance name of next_btn using the Properties panel. In Scene 2, name the button prev_btn.

  4. Remember that the playhead will automatically move between scenes by default, so you need a script to prevent this from happening. In the first and only frame of each scene, add a stop() action.

  5. Now you must script the button. In the first frame of Scene 1, add an onRelease event handler to the next_btn instance with a nextScene action. Your frame script should now look like this:

     stop(); next_btn.onRelease = function() {     nextScene(); }; 

  6. Follow a similar course in the first frame of Scene 2, this time adding the prevScene action to the prev_btn instance:

     stop(); prev_btn.onRelease = function() {     prevScene(); }; 

  7. Save your work and test your movie. You will see that the movie does not automatically switch scenes, and now does so only when you click on the buttons you created. If you want to check your work, pdf_scenes_02.fla, found in the same folder, is the complete file.

Flash 8(c) Projects for Learning Animation and Interactivity
Flash 8: Projects for Learning Animation and Interactivity (OReilly Digital Studio)
ISBN: 0596102232
EAN: 2147483647
Year: 2006
Pages: 117

Similar book on Amazon © 2008-2017.
If you may any questions please contact us: