GDT 260 Animation for the Web: Winter 2002
2.26.02
Actions & Interactions
Download digihit_02.aif
Interactivity: the ability of the movie to respond to user actions. In Flash, all interactivity is accomplished by ActionScript.
Events
Flash and actionScript are event-driven: something needs to happen, and Flash will handle that event and execute an action.
- Event
- something that happens, for example, a mouse click, or the movie enters a certain frame, or the user hits a certain key.
- Event Handler
- the movie's response to an event, in the form of
on (event) { do some stuff };Basically a set of instructions to watch for an event and then do something when that event occurs.
The most straightforward event-sensitive element is a button, which already has different visual states that respond to events. By adding an event handler to a button, the button will watch for the specified event, and follow the directions when it happens.
Buttons aren't inherently interactive - need actionScript to tell them what to do.
ActionScript allows non-linear timeline - decision-making & choice by user
Timeline vs Instances
ActionScript can be attached to the timeline or to instances of symbols
- ActionScript on the timeline reacts to the playhead moving into a frame
- ActionScript on an instance (most easily a button) reacts to user-initiated events - clicks & mouseovers
Button Events
- Press a mouse click, when the button is actually down
- Release when the mouse button is released
- Release Outside when the mouse button is released after the user moves the mouse off the button
- Roll Over, Roll Out when the mouse moves over a button, and when it moves off of the button
Actions attached to buttons on the stage are attached to that instance only, not to the item in the library