• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Part III: Navigating Timelines and Commu... > Advanced Buttons and Event Detection

Chapter 4. Advanced Buttons and Event Detection

Creating graphics and animation in Flash is only half the story. You can incorporate interactivity via buttons, the keyboard, and the mouse to give the viewer control of those graphics and animations. Interactivity is essential for basic site navigation and e-commerce interfaces on the Web, as well as for game development, online tutorials, or anything else that requires the viewer to make choices.

What makes a movie interactive? Interactivity is the back-and-forth communication between the user and the movie. In a Flash movie, the user might react to something that’s going on by moving the pointer, clicking the mouse button, or pressing a particular key on the keyboard. That reaction may trigger a response from the Flash movie, which in turn prompts the user to do something else. The things that the user does—mouse movements, button clicks, or keyboard presses—are part of things that happen, called events. Events form the basis of interactivity. There are many kinds of events; even events that happen without the user knowing about them. You will learn to detect these events and create the responses to events in statements conveniently known as event handlers.

This chapter first introduces events, event handlers, and anonymous functions used for event handling. Next, you explore the simplest object that handles events: the Button object. You’ll learn how to extend its functionality by creating invisible buttons, tweening button instances, and creating fully animated buttons. You’ll tackle the issues involved in creating a more complex button, such as a pull-down menu, which includes different button events, tracking options, and movie clips. You’ll also learn about the Key object and the Mouse object, as well as how to create actions that run continuously. Understanding objects and event handling is essential to Flash interactivity, because these elements are the scaffold on which you will hang virtually all your ActionScript.

  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint