Activity 5: Tweening

Intent:

Identifying animations in the Timeline

(source: http://helpx.adobe.com/flash/using/animation-basics.html)

Flash Pro distinguishes tweened animation from frame-by-frame animation in the Timeline by displaying different indicators in each frame that contains content.

 

Task:

  • Open up firstlastname_activity6.fla,
  • Save it as firstlastname_activity7.fla in your Thawed Drive, AnhrMohr/Unit 1/Activity 7 subfolder (create one if you do not have a folder created), and then click Save.

Follow these steps to create a symbol:

  1. Click the Selection tool in the Tools panel (see Figure 9).

Tools panel with the Selection tool selected

Figure 9. The Selection tool is the first item displayed in the Tools panel.

  1. Click the circle on the Stage to select it. A bounding box selection appears around the circle.
  2. While the circle is still selected, choose Modify > Convert to Symbol (or press F8) to access the Convert to Symbol dialog box (see Figure 10). Enter the name of the symbol in the Name field. Use the Type menu to select the Movie Clip option.

Tip: You can also convert a graphic into a symbol by selecting it and dragging it into the Library panel.

Convert to Symbol dialog box

Figure 10. Enter a descriptive name for the symbol in the Convert to Symbol dialog box.

  1. Click OK. A square bounding box is displayed around the circle symbol. You’ve just created a reusable asset, called a symbol, in your document. In this case, you created a movie clip symbol named my_circle. (For more information about symbols, read Working with symbols in the Flash Professional online documentation.)

If the Library panel is not open, choose Window > Library to access it. The new symbol is now listed in the Library panel. (When you drag a copy of the symbol from the Library panel to the Stage, the copy on the Stage is called an instance of the symbol.)

Animating the circle

In this section, you’ll use the symbol in your document to create a basic animation that moves across the Stage:

  1. Select the circle on the Stage and drag it off the Stage area to the left (see Figure 11).

Circle moved to the left of the Stage area

Figure 11. Reposition the instance of the my_circle symbol to the left of the Stage area.

  1. Right-click the circle instance on the Stage and choose the option to Create Motion Tween in the menu that appears. Notice that the Timeline is automatically extended to Frame 24 and the red marker (the current frame indicator, also known as the playhead) moves to Frame 24 (see Figure 12). This indicates that the Timeline is prepared for you to edit the ending location of the symbol and create a one-second animation—assuming that you haven’t changed default frame rate for the project from 24 fps in the Property inspector. A span of 24 frames is the equivalent of one second at a rate of 24 fps. (For more information about the Timeline, read Working with timelines in the Flash Professional online documentation.)

Extended Timeline ready for editing on frame 24

Figure 12. The Create Motion Tween operation automatically extends the frames in the Timeline and places the playhead on Frame 24.

  1. While the playhead is still on Frame 24 of the Timeline, select the circle instance on the Stage and drag it to the right, just past the Stage area. This step of relocating the instance creates a tweened animation. On Frame 24, notice the diamond-shaped dot (known as a property keyframe) that appears. On the Stage, also notice the motion guide that indicates the circle’s path of motion between Frame 1 and Frame 24 (see Figure 13).

A 24-frame animation showing the circle at the end of the animation on frame 24

Figure 13. After creating a 24-frame tween animation, the circle is located at the far right at the end of the animation (when the playhead is located on Frame 24 of the Timeline).

  1. In the Timeline, drag the red playhead back and forth from Frame 1 to Frame 24 to preview the animation; this is known as scrubbing the Timeline.
  2. You can change the circle’s direction in the middle of the animation. First, drag the playhead to Frame 10 in the Timeline. Then select the circle and move it to another location, further down on the Stage. Notice that the change is reflected in the motion guide and the new dot (property keyframe) appears on Frame 10 of the Timeline (see Figure 14). The property keyframes on the Timeline mark the timing of the animation, indicating the frames whenever objects change on the screen and storing the properties of the object that change. In this example, it is the circle’s location on the Stage (known as its X and Y or horizontal and vertical) properties that are changing as the playhead moves across the Timeline.

The tweened animation showing a change in direction at frame 12

Figure 14. After placing the playhead on Frame 10 and dragging the circle instance down on the Stage, the motion guide of the tweened animation and the property keyframe in the Timeline reflect the location change of the animated circle.

  1. Experiment with editing the animation by changing the shape of the motion guide path. Click the Selection tool in the Tools panel and then click a section of the motion guide line. Drag it to bend the line shape (see Figure 15). When you bend the motion path, you cause the animation to follow along a smooth curved line instead of a rigid straight line.

The tweened animation showing curves added to the motion guide line

Figure 15. Use the Selection tool to adjust the tweened animation’s motion path; rather than a straight line the edited motion guide line is now curved.

  1. Choose Control > Test Movie to test the FLA file and watch the animation play back in Flash Player.
  2. The movie loops automatically, so you can watch the circle move across the window repeatedly. When you are finished, close the Test Movie window.

Using a stop action to stop the Timeline from looping

When you tested the movie, the animation loops by default as the movie plays in Flash Player. This occurs automatically because in Flash Professional, the Timeline is set up to loop back to Frame 1 after exiting the last frame—unless you instruct the movie to do otherwise. When you want to add a command that controls the Timeline, you’ll add ActionScript code to a keyframe (indicated by a dot symbol) on the Timeline. This is known as adding a frame script.

Tip: Keyframes are used to place ActionScript and assets on specific frames in the Timeline. When you review the Timeline of a FLA file, you can locate scripts and content by looking for the keyframe dots. Keyframes that have frame scripts display a lower case “a” symbol.

Follow the steps below to add ActionScript code to your FLA file. You’ll add one of the most common Timeline commands, which is called the stop action:

  1. It’s always a good idea to name your layers if you have more than one. A large project can quickly become unmanageable if its layers are not descriptively named. Double-click the name to rename Layer 1. In the field that appears, enter the new name: animation.
  2. Click the New Layer button (page icon) in the lower left of the Timeline panel. In an ActionScript 3 file, the ActionScript code must be added to the Timeline. It’s considered best practice to create a layer named actions at the top of the layer stack, dedicated to holding the ActionScript code. Rename the new layer you just created to: actions. Make sure it is located above the animation layer. Now that you’ve created a layer to place your scripts, you can add keyframes to the actions layer to associate the ActionScript code with specific frames.
  3. Move the playhead to Frame 24. Click the actions layer at Frame 24 (to highlight the last frame on the actions layer). Insert a keyframe on Frame 24 of the actions layer by choosing Insert > Timeline > Keyframe (or pressing F6). Notice that an empty, blank keyframe appears (you can tell that the new keyframe doesn’t contain any graphics because the dot icon for the keyframe is hollow, rather than displaying a solid color).
  4. Select the new keyframe with the Selection tool. Open the Actions panel (Window > Actions). The Actions panel contains the Script window, which is a large text field you’ll use to type or paste ActionScript code directly into your FLA file. Place your cursor in the text area next to the number 1 (line 1) and type in the following action:

stop();

Note: This step assumes that you’re using the default mode of the Actions panel. If the Actions panel is in Script Assist mode, it won’t allow you to type directly into to the text area. To return to the default mode, uncheck the magic wand icon in the upper right corner of the Actions panel.

  1. After typing the line of ActionScript code in the Script window, you’ll notice that a little “a” icon appears above the keyframe in the actions layer of the Timeline. This indicates that the keyframe contains a frame script (also known as an action). At this point, your Timeline should look similar to Figure 16. Close the Actions panel. If you need to edit the code, you can always select the keyframe in the Timeline and then open the Actions panel again.
  2. Choose Control > Test Movie to test the FLA file and watch it play in Flash Player. Notice that this time, the animation doesn’t loop. You can return to Flash and test the movie again to watch the movie play again.

The completed timeline showing the stop action applied to frame 24 of the actions layer

Figure 16. Add the stop action frame script to Frame 24 of the actions layer.

  1. When you are finished previewing the animation, close the Test Movie window.
  2. Back in Flash, save the FLA file.
  3. Go to File/Export/Export Movie as: firstlastname_activity7.swf

activity from: http://www.adobe.com/devnet/flash/articles/flash_cs5_createfla.html

Resources:

Basic Motion Tween:

courtesy: http://www.youtube.com/watch?v=l8gANx77Ksw

Flash Professional CS5 Keyboard Shortcuts for Menu Commands

Many Flash Professional CS5 menu commands offer keyboard shortcuts. The shortcuts are displayed on the menus, next to the command name. The most commonly used Flash Professional CS5 keyboard shortcuts for menu commands are shown in the following tables.

flash-cheat-sheetflash tools

 

It is common to use symbols to create tweened animations. You can also use symbols to store graphic content (as described in the next set of steps). As you become more familiar with Flash Professional, you’ll use symbols to structure applications and interactivity using multiple timelines. Symbols are useful for compartmentalizing parts of a project to make it easier for you to edit specific sections later.