Events in ActionScript3

Get Adobe Flash player

Try each of the buttons above. At this point, the zebra button doesn't do anything.

Download the animalbutton movie and open it in Flash.

Frame Names

Notice that the frames have names: bear, cat, and zebra:
frames are named

The names are added to the frames in the property window.
frame property

The two lines below would do the same thing: They will both go to frame 2 that is named bear.


The second is much better because it will still work even if we add more frames, and it is easier for us, as humans, to remember names instead of numbers.

The code adds an event listener for the buttons and writes the functions to gotoAndStop the named frame.

stop(); //without this the movie will start by looping through all of the frames
function goBear(e:MouseEvent): void {

function goCat(e:MouseEvent): void {

To Do:

  • Make the zebra button go to the picture of the zebra.
  • Add another animal.


Create a "resume" movie with buttons for contact information, skills, education, work experience, and contacts.

Create a movie for a restaurant with buttons for hours, location, menu, etc.

Use your imagination! The possibilities for this type of movie are endless.

NEXT: Frame Event: A Spinning Star