Some AS3 examples

Here are a few basic AS3 examples. These cover some of the everyday chores that you may need to solve with AS3. Such as:

  • Making buttons and assigning scripts to them.
  • Using the Document Class. All of these examples store their script in the Document class.
  • Creating a group of buttons. Enabling and disabling buttons.
  • Loading images into a movie.
  • Animating the timeline.
  • Animating the properties of clips.
  • Attaching clips to the stage.

All of these examples store their scripts in a class file that has the same name as the example fla. This file is set as the Document class in the fla.

A few simple AS3 examples

Updated 10/13/07, added an extra example that attaches and removes symbols in the library to the stage.

5 thoughts on “Some AS3 examples”

  1. Hi Mitch

    Thanks for the examples! One question, do you find yourself using the MovieClip class as frequently in AS 3.0? I know that Adobe has moved a lot of methods out of it and into the “display” model.

  2. I think the MovieClip is essential if you are attachIng clips from your library or working with clips that you have created in Flash. If you are making stuff dynamically then it’s all about the Sprite class.

    Any class that is going to be displayed on the stage should extend Sprite or MovieClip. If the class doesn’t have a timeline Sprite is the choice.

    I have been trying to wrap my head around the new Display model. I spent some time last night trying to solve a problem. After a while I realized I had forgotten to add my Sprite to the display list. Doh! The clip was a little complex with several nested sprites which I had added to the display list of the parent class. But the parent had not been added to the main document class.

Leave a Reply

Your email address will not be published. Required fields are marked *