Home > Articles > Web Development > Dreamweaver & Flash

  • Print
  • + Share This
This chapter is from the book

Events and Event Handlers

In the interactive world of ActionScript, events are happening all the time. However, your movie wouldn't know about any of those events if it weren't for the event handlers that are triggered when an event happens.

There are two ways to handle events. We've already seen it for buttons:

	do something

Here's what an event handler for movie clips looks like.

	do more stuff

The other way to handle this is a little different:

myButton.onPress = showFishFunction

In this case, we're using the onPress, instead of the on, event handler. If the user presses the button, then the showFishFunction is called. We'll see more of this kind of event handling later in the book.

Buttons, movie clips, and the Mouse object all have their own event handlers.

What's a function? I'm glad you asked.

  • + Share This
  • 🔖 Save To Your Account