VirtualMV/Flash12 (CS6)/Journal/Content/Stop Box

From WikiEducator
Jump to: navigation, search


VmvIcon Objective.png

By the end of this exercises you should be able to:

  • Add empty frames at the start of a movie
  • Introduce the Action Script 2.0 Stop Movie command

Pre loaders

In many flash movies it is common to use preloaders to load large files into the movie before the presentation starts (you often see progress bars at the start of sophisticated flash movies)

What we can do is let the first frame contain the preloader. This means that we need to move all the content over one frame (so that they come on stage in frame 2)

Moving all frames

1. Move all the Frame objects currently in Frame 1 to frame 2, by

a. Shift clicking on all objects in frame 1 - until they are all highlighted.

b. Right click and Insert Frame. (Frame 1 objects should remain selected)

c. Right click and Clear Frames

Lets test the movie…

2. Press [Ctrl]+[Enter]

You probably noticed that when you Test the Movie (Control > Test Movie), the movie loops continuously, that is, the movie flashes on and off. This happens as frame 1 is empty so the stage is cleared, then frame two is displayed (so they all reappear). You can see this if you drag the red bar on the timeline from frame 1 to frame 2. Flash movies cycle back to the start unless told to stop, so… lets add a stop command to halt the movie at frame 2.

Stopping the movie

Our first command is to stop the movie once it displays frame 2

Fla10 AS2 StopAction.png

1. Add a new layer called Actions, as the top layer

2. Click on Frame 2 of the Actions Layer and Insert a keyframe (as we want something special to happen here!)

3. Press [F9] or Select Window > Actions

4. In the Left hand pane (Beneath ActionScript 1.0 & 2.0) Click Global Functions to expand, then Timeline Control to expand.

5. Double click stop and this will type in the stop command for the movie. (Simple aye!!)


6. Press [F9] to close the Actions Pane.

7. With frame 2 of the actions layer selected, in the Properties pane, change the Frame > Label Name to //stop. The label type will change to a comment. If there was enough room on the actions layer //stop would appear. This means you can add some documentation to your instructions so you can tell what is happening by reading the timeline.

8. Now Test the movie ([Ctrl]+[Enter], and it should now play through once only. So we are in control!

Action Script 3.0

Stop Action:

ActionScript 3.0 > flash.display > MovieClip > Methods > Stop

Change not_set_yet.stop() to this.stop() (tells the program to stop the currently selected MovieClip)}