Flash MX ActionScript Banner Search Macromedia.com

Intro - Flash History

Flash ActionScript

Building User Interfaces

Object Oriented Techniques

Beyond Flash MX





Author Notes

Figure Captions


Email Dianne


Using Flash MX ActionScript

Flash ActionScript

Real Application User Interface

Rich Internet Application picture
Figure 3. Flash application example taken from the Moen.com websitehttp://www.moen.com/consumer/homepage/index.cfm?CFID=2852066&CFTOKEN=57311786

What is Flash’s ActionScript Language?

Flash has a built in programming language called ActionScript. It is similar to JavaScript, but has a lot more functionality. With Flash, you can create lists, trees, input fields, buttons, sliders, and many other components that help build user interfaces. Kollmeyer says, “The possibilities for creating sophisticated controls go way beyond what was possible with client/server tools (at http://www.blueedgedata.com/flash/flashremoting.htm, 2002)”.

Users have come to expect the cool animations and interactivity that Flash allows developers to create. A Flash developer can no longer just know how to do animation; they need know how to use ActionScript to create the interactive websites. Franklin says that by acquiring an in-depth knowledge of ActionScript, you can (p. 8, 2002):

  1. Provide a personalized user experience
  2. Achieve greater control over movie clips and their properties
  3. Animate elements in your movie programmatically—that is, without using the timeline
  4. Get data in and out of Flash to create forms, chat programs, and more
  5. Create dynamic projects that respond to the passage of time or the current date
  6. Dynamically control sound volume and panning
  7. Much more

Animation Basics

The basic way Flash started out was through its animation capabilities. Flash uses a timeline to make an object change size, color, position or shape. In Flash you can create animations by tweening or by using frames. Watrall and Herber tell us that Flash’s timeline represents different kinds of animation differently by doing the following (p. 163-164, 2002):

  • A frame-by-frame animation is usually represented by a layer with a series of sequential keyframes.
  • A motion tween is denoted by a keyframe at the beginning and end, between which a black arrow (representing the actual tween) runs. In addition, a motion tween has a light blue background.
  • Like a motion tween, a shape tween is denoted by a keyframe at the beginning and end, between which a black arrow (representing the actual tween) runs. The difference is that the intervening frames are light green instead of light blue.
  • When a keyframe is followed by a dashed line, motion tween is incomplete (usually the result of the final keyframe being removed or not added).
  • A frame or keyframe with a small lowercase a represents a point in the animation where a frame action has been added.
  • A frame or keyframe with a red flag indicates the presence of a frame label.
  • ActionScript Elements

ActionScript in Flash is used to make actions happen in the Flash movies. To make an action happen you need to specify and event that will trigger the code. There are many ActionScript commands, but Bhangal mentions the following as a just a few that we can use (p. 12, 2002):

  • stop() - myMovieClip.stop() tells myMovieCilp to stop playing, wherever it is in its timeline. If we have this code at the very beginning of our movie, then when our movie clip begins it will immediately stop on frame 1.
  • gotoAndPlay() – myMovieClip.gotoAndPlay(5) tells myMovieClip to jump to frame 5 of its timeline, and then continue playing along.
  • gotoAndStop() – myMovieClip.gotoAndStop(5) tells myMovieClip to jump to frame 5 of its timeline, and then stop playing.
  • nextFrame() – myMovieClip.nextFrame() tells myMovieClip to move to the next frame in its timeline and stop there.
  • prevFrame() – myMovieClip.prevFrame() tells myMovieClip to move to the previous frame in its timeline and stop there.
  • The dot notation used tells the movie what frame the ActionScript is to be applied.

Animating with ActionScript

Good coding practice for ActionScript developers says to put the code on a layer in the movie called actions. This keeps the code and the graphics separate from each other. With ActionScript you can control dynamically the appearance and movements of Movie Clips. Watrall, and Herber show us and example of how this can work in the tracking of your mouse position. They use the _xmouse for the horizontal position, and the _ymouse for the vertical mouse position, and this allows them to get the coordinates of the mouse position (p. 334-335, 2002). Some other effects that Flash developers can do are changing appearance and creating cool graphic effects.

Here is an excellent site for learning more about Animating with ActionScript http://actionscript-toolbox.com/examples.php

Back to Top