Movie Clips
Frame Actions


 

FRAME ACTIONS

 

 

Youll need to give Flash instructions. Among other things, youll tell Flash to stop the movie, play the movie, or jump to a specific place in the timeline. These tasks that Flash will perform at your request are called "actions".

Sounds fun, no?

There are two types of actions.

Button actions perform a specific task when a button is clicked. Among other things, you can use button actions to jump to a different part of the timeline, stop the movie, or instruct a movie clip to start playing. Were not going to mess with buttons too much right now, but well get to them later.

The other type of action is a frame action. A frame action is automatically triggered when the playback head reaches a certain frame. Among other things, frame actions can be used to stop the movie, jump the playback head to a different part of the timeline, or preload frames to ensure a smooth playing animation.

 

Correctly Inserting a Frame Action

Remember that a frame action is a task that is automatically triggered when the playback head reaches a certain frame. First off, a frame action needs a keyframe to attach to. Youll want to take care when placing your keyframes. When the playback head reaches the keyframe holding a frame action, it will immediately play the action.

 

Youll Put All of Your Frame Actions on the Top Layer

Frame actions will work wherever you place them, but if youve got fifty layers, it can get very easy to misplace your actions. If another designer ever takes over maintaining your site theyll be totally lost.

Professional Flash designers create a special top layer specifically for frame actions. That layer is usually named "Actions". The actions layer is a normal layer except that they only hold frame actions.

When you create an actions layer, youll want to make sure its the top layer. The top layer is easily findable, and items on the top layer will be the first read and acted upon by a users computer.


a screenshot from the flash file that makes up the web design course page

 

Adding a Frame Action

Adding a Frame action is easy. In a minute, well go through an exercise, but first real the basic steps required when adding a frame action.

  1. Add or select a keyframe
  2. Open the Actions Palette
    (WINDOW-> ACTION) or (CTRL/CMD + ALT + A) or (DOUBLE CLICK ON THE KEYFRAME)
    Isnt is great to live in a free country where you get so many choices to open the Actions Palette?

 

The Frame Actions Palette should open. Mostly, well use the Basic Actions. Most of the other actions are for use with a basic programming language called action scripting. Well discuss action scripting later.

 

  1. Open the Basic Actions By clicking on the plus sign.
    Youll be able to see the actions.

 

  1. Choose an action.

 

Youll notice that coding for your action was added to the right side of the Frame Action Palette.

 

You may also notice that a small "a" appeared in your keyframe.

 

You can add more than one frame action to a frame.

 

Removing or Editing a Frame Action

You can remove an action by clicking its keyframe and deleting the action from the display window on the Action Panel.

 

Using Frame Actions

In this section, well go through an exercise to use the stop action to keep a movie from looping. The stop action can also be used to halt the movie while youre waiting for a user to make a choice about what button they want to click or what theyre going to do next.

  1. Build a small, twenty-frame movie. It doesnt have to be anything special. A symbol animating across the screen will do fine.
  2. Hit F12 to test the movie.
    Notice that it loops.

 

Now were going to place a stop action on the last frame of our twenty-frame movie. The stop action will keep halt the playback head when it reaches frame 20, thus keeping the movie from looping.

 

  1. Add a new layer and name it Actions.
    Remember that frame actions should get their own top layer.
  2. On the Actions Layer, add a keyframe (F6) on frame 20

 

  1. Open the Actions Palette
    (WINDOW-> ACTION)

 

  1. Open the Basic Actions By clicking on the plus sign.
    Youll be able to see the actions.

 

  1. Choose Stop.

Youll notice that coding for your action was added to the right side of the Frame Action Palette.

 

You may also notice that a small "a" appeared in your keyframe.

  1. Hit F12 to test your movie.
    It should stop at the end!

 

Actions Will Not Work During Normal Playback

 

Youll have to test the movie (F12) to see the action function.

If you want to, you can activate the action inside of Flash by clicking:

CONTROL-> ENABLE ACTIONS

 

Understanding Basic Actions

Most of the basic actions do exactly what they sound like they do. Remember that all frame actions are automatically triggered when the playback head reaches them. This section is intended to give you an understanding of what each action does. We will use most of these actions later on.

 

Go To

The Go To action instructs the playback head to jump to a certain frame, frame label, or scene.

The Go To action is normally set to play when it reaches its destination. Go To can be used for both Frame Actions and Button Actions. Later we will create interactive navigation using the Go To action.

 

 

Play

Play instructs the movie to play.

Play can be used for both Frame Actions and Button Actions.

 

Stop

Stop stops the movie. Stop is the most often used Frame Action. Without the stop action, your movies would need an infinite number of frames. Usually the movie will stop and wait for the user to click a button, which starts the movie again.

Stop can be used for both Frame Actions and Button Actions.

 

Toggle High Quality

If anti alias is used in a movie, toggle high quality will turn it on or off (depending on its current state). Anti-alias is used by Flash to smoothly blend one color into another. It looks great, but is harder for slow computers to animate. You can use Toggle High Quality as a frame action to turn off anti alias before a particularly processor intensive animation segment. Chances are that if your animation is fast moving that anti-alias wouldnt have made a difference in looks, anyway. Once the animation is over, you can use Toggle High Quality again to turn anti-alias back on.

If you wanted to, you could assign Toggle High Quality to a button, but that would assume that your user knew what was best for them

 

Stop All Sounds

Stops all sounds playing in the movie. Usable as a frame action to stop a looped or playing sound when your user navigates to a different part of the movie. Also usable on a button to allow a user to turn off sounds.

 

Get URL

Links the browser to a different URL. The address can be inside your site, or on the World Wide Web.

 

Get URL can be used for both Frame Actions and Button Actions.

 

FSCommand

Flash can create a totally independent movie that runs without the help of a browser or a plug-in. The FSCommand actions control the display properties of the stand-alone projector.

We will talk more about the FSCommand when we come to publishing our Flash movies.

 

Load Movie

You can use Load Movie to load and play totally separate Flash movies inside of your current movie.

Load Movie allows you to break your work into segments. This can be useful in larger sites to allow users to navigate to different parts of the site, even if that part hasnt loaded into memory yet. You could also use Load Movie as a frame action to automatically load unrelated Flash Movies (like banner adds)

We will more fully explore the Load Movie action a little later.

 

Tell Target

The Tell Target Command is used to instruct movie clips to do something. It "tells" a specific "target" (movie clip) to play, stop, or perform any other action.

 

If Frame is Loaded

The If Frame is Loaded action is used to create a preloader. It checks to see if a specific frame is loaded. If the frame is not loaded yet, the playback head continues on its way. Usually the playback head will next encounter a Go To frame action that jumps back before the "If Frame is Loaded" action. This loop continues until the specified frame is loaded, at which point the movie skips ahead of the jump frame.

 

On Mouse Event

The On Mouse Event action allows you to assign an action to a keyboard key or a mouse event (like right click)

 

 

| Back to Courseware