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

Lesson 9. Built-In Behaviors > Using the Behavior Inspector

Using the Behavior Inspector

With behaviors, you can animate within a single frame just as easily as you can animate within 28 frames. If this animation were a portion of a larger project, you could make the project easier to work with by keeping the score as compact as possible.

Open the Score window again and compact all three sprites into a single frame.

To do this, click the sprite in channel 1 and then Shift+click the sprite in channel 3 to select all three sprites. Then enter 1 in the end frame box of the sprite toolbar.

Figure .

Now if you play the movie, it will finish playing in only a fraction of a second. You can use a behavior to keep the movie playing in the one frame.

Click any unoccupied cell in the score. Open the Behavior Inspector by choosing Window > Inspectors > Behavior (Windows Ctrl+Alt+;, Macintosh Command+Option+;).

An empty Behavior Inspector window opens. Selecting an unused cell in the score before opening the Behavior Inspector informs the Behavior Inspector that the behavior will not be automatically attached to a sprite. If the Behavior Inspector does not look similar to the illustration shown here, click the Expand Editing Pane arrow to open the lower panes.

Figure .

Click the Behavior pop-up button and select New Behavior. In the Name Behavior window, name the new behaviorHold and then click OK.

The Behavior Inspector indicates that a new score behavior is being created and that the new behavior is placed in the cast as cast member 4.

Figure .

Click the Event pop-up button and select Exit Frame. Click the Action pop-up button and select Wait on Current Frame.

The Behavior Inspector reflects your selections.

Figure .

The behavior is created and placed as cast member 4.

Figure .

Unlike some other behaviors, the Wait on Current Frame behavior does not prompt you to set any customizable properties. Its only action is to keep the playback head from moving past that frame, effectively forcing an indefinite loop on the frame in which it is used.

In the Cast window, select the new behavior cast member and drag it to the score in frame 1 of the behavior channel.

Figure .

On the control panel, make sure that Looping is turned off. Play the movie. Move the cursor around the screen.

This time the movie keeps playing because the behavior keeps the movie in a continuous loop on frame 1. As you move the cursor around the screen, the eyeball sprite with the Turn Towards Mouse behavior rotates the sprite to follow the cursor. The eyeball without the special behavior remains stationary, since it has no instructions to the contrary.

Figure .

Save your work.



Not a subscriber?

Start A Free Trial

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