How to Do Stuff in Flash with ActionScript 3.0 (AS3)

These free tutorials for beginners provide most of the instructions in the FLA file, which you can download. Comments are included to help you understand the ActionScript.

Note that all FLAs here are Flash CS4 unless otherwise noted. All ActionScript in these files is AS3. CS4 files (FLAs) should work fine in Flash CS5, but they will not open in earlier versions of the Flash application. If you find an error in any FLA you download here, please let me know.

Absolute Beginners

Image: Buttons

Buttons: The most basic button scripts: stop(); and play(); The most basic interactivity. A must-learn skill in Flash.

Image: Timeline Workflow

Timeline Workflow: Combining tweens and frame labels can be confusing for a beginner. Yet this is the key to creating a simple information package with buttons that take you from segment to segment. This example illustrates best practices for the structure of the Flash Timeline.

Image: Animation Basics

Animation Basics: This step-by-step illustrated tutorial shows you how to make your first animation in Flash.

Image: Masks

Masks: You'll be surprised by how easy it is to create a moving mask in Flash. No ActionScript required!

Intermediate Timeline Flash

Image: Info Panel

Info Panels: If you want information to appear in a box or panel, you'll want to learn about the movie clip symbol. These two examples show a panel that fades in and out, and another panel that slides in and out.

Image: Movie Clips

Movie Clips: If you have mastered basic animation and buttons, you're ready to unlock one of the more powerful goodies in Flash, the movie clip symbol. Movie clips are independent Timelines inside your main Timeline. You can nest movie clips to provide complex functionality in your movies.

Image: Sliding Panel

Sliding Panel: A sliding panel is one of the more common uses of the movie clip symbol in informational packages. By using a movie clip, you ensure that none of the animations, etc., are affected by the sliding in and out of the panel overlay.

Storytelling

Image: Loading Soundslides

Loading Soundslides: The popular Soundslides program creates SWF files, and therefore it is very easy to create a neat package that bundles several Soundslides together with one consistent interface.

ActionScript Essentials

Image: ENTER_FRAME

ENTER_FRAME: This very handy Event is often used to produce continuous motion without using any tweens -- that is, animating with script only.

Image: Loader

Loader: The secret to displaying external images (and even other SWF files) is the correct use of the Loader object.

Image: Sound Controls

Sound Controls: Don't make your Flash files huge by adding audio on the Timeline. Instead, load external MP3 files dynamically. The basic play and stop scripts are not complicated.

Image: Calculator

Calculator: Learn how to work with variables, math and text fields. These are real essentials for scripting.

Image: Dragging

Dragging: Making a slider bar requires you to drag a movie clip symbol. Dragging objects is not very difficult, but there is a trick to it.

Intermediate ActionScript

Image: XML Loader

XML Loader: Essentially a simple linear slide show using JPGs and text loaded via one external XML file, this example shows you how to use any size XML file in a (basically) empty SWF. Easy to adapt to other content.

Image: Unloading SWFs

Unloading SWFs: When you load external SWFs into a master SWF, how can you script the loaded one so that it can unload itself? It's less easy than it sounds -- but this example shows you exactly how to get the job done.

Image: myScrollbar

myScrollbar: The trouble with using most scrollbars for text fields is that you can't easily convert the appearance of the controls to match your own design. With only a few simple movie clips, myScrollbar lets you modify size, shape, color and so on. It's not a component, so it's only 8 KB in the SWF.

Image: Changing color

Changing Color: ActionScript can be used to change the color of any movie clip. With a little finesse, you can change the background color of an entire movie. This example uses buttons to change the colors dynamically.

Education use: These tutorials were created for my journalism students. They are not intended to be used commercially, and such use is prohibited.

Use and re-use: How to Do Stuff in Flash with ActionScript 3.0 (AS3) by Mindy McAdams is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 United States License.
Creative Commons License

Updated 20 March 2011