ActionScript 3.0 Design Patterns

(Chris Devlin) #1
The Pleasure of Doing Something Well | 9


  1. Drag a copy of the Rocket movie clip from the Library to the center of the stage.
    Move the center point of the movie clip to the rear of the rocket and position it
    at X=0, Y=0.

  2. Click on Frame 40 of the Timeline and press F5 to create 40 frames. Click Frame
    40 again and press F6 to insert a keyframe. Click on the keyframe in Frame 40
    and move the rocket to X=400, Y=0.

  3. Click on the first keyframe, and, in the tween drop-down menu in the Properties
    inspector, select Motion. You should now see a blue arrow in the Timeline.
    Move the playhead from left to right to make sure that the motion tween is
    working right. Figure 1-4 shows what you should see.

  4. Open the Actions panel. Click on a blank area of the stage to make sure you
    don’t have any objects selected, and then click on Frame 1. In the Actions panel,
    type in thestop() statement. Save theRocket.fla file.

  5. Open a new ActionScript file and save it asTestRocket.asin the same folder as
    theRocket.flafile. Enter the script in Example 1-1 in theTestRocket.asfile, and
    save the file once again:


Figure 1-4. Rocket in motion tween


Center point

Current position Ending position
Free download pdf