• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Lesson 8. Film Loops and Buttons > Creating a Behavior to Pause the Movie

Creating a Behavior to Pause the Movie

There is still something you need to do. Watch the playback head when you click one of the buttons; it branches to the appropriate frame and then continues through the score. Thus, when you click Forward, the playback head branches to frame 1 and then moves left to right until it reaches the end of the score—that is, it also plays the Backward sequence. To prevent this, you will create a behavior named Pause and attach it to the end of each animation. Then the animations will play once through and stop to wait for another click on the Forward or Backward button before resuming.

1.
Click anywhere in the score where there is no sprite. Then choose Window > Inspectors > Behavior.

If a sprite had been selected, any behavior created in the Behavior Inspector would be assigned to that sprite. At the moment, you want to create a behavior that is not assigned to any sprite, so you selected an unoccupied cell in the score before opening the Behavior Inspector.

Tip

Whenever you use the Behavior Inspector, select an unoccupied cell first unless you want to assign the behavior to specific sprites. Creating behaviors when sprites are selected will assign the behavior to those sprites, even though you may not have intended to.

2.
Choose New Behavior from the Behavior menu, type Pause in the Name Behavior dialog box, and click OK.

This will create a new behavior cast member named Pause. Now that you have named the behavior, you will set up its events and actions.

3.
Choose Exit Frame from the Events menu.

In Lesson 5, you learned how to make the playback head stay in a frame using a go to the frame command. The go to the frame command ran each time the playback head exited the frame, and it returned the playback head to the same frame. The behavior you are creating uses the same Lingo—but this time, you will use the Behavior Inspector instead of typing the command as you did in Lesson 5.

4.
Choose Wait > On Current Frame from the Actions menu.

Now when the playback head exits the current frame, it will be instructed to go to the current frame.

If you examine the cast, you will see a new cast member named Pause in cast location 14. As in the previous task, this new cast member is not assigned to anything because you made sure that no sprites were selected in the score before you created the behavior.


Figure .


5.
Drag the Pause cast member to frame 30 in the behavior channel. Then repeat the process, this time dragging the Pause cast member to frame 70.

Frames 30 and 70 are the end points of the two animations. When the playback head reaches these two points, the papers will have completed their journey from one folder to another.


Figure .


6.
Play the movie. Click the Forward and Backward buttons several times.

Watch the playback head. When you click Forward, it branches to frame 1 and then moves from frame to frame until it reaches frame 30, where it pauses because of the behavior you just added. When you click Backward, the playback head branches to frame 41 and moves from frame to frame until it reaches frame 70, where it also pauses. Each time you click a button, the chosen animation plays once. Then nothing happens until you click a button again.

7.
Save your work.


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint