O'Reilly logo

Flash® Builder™ 4 and Flex® 4 Bible by David Gassner

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 7. Working with Events

IN THIS CHAPTER

  • Understanding the Flex event architecture

  • Using MXML event listeners

  • Generating event handler functions with Flash Builder 4

  • Handling events with addEventListener()

  • Declaring and dispatching custom events

  • Creating and using custom event classes

Flex applications are event-driven, which means that with the exception of the first phases of application startup, every action is the result of some trigger that causes the action to take place.

Many events are produced by internal functions within the Flex framework that don't necessarily have anything to do with a user's interactions with the application. These are sometimes known as system events. Other events, known as user events, are designed to inform you of actions taken by the user. These actions, known as user gestures, consist of key presses or mouse actions such as moving the mouse or pressing one of its buttons.

Regardless of how an event is generated, you can capture and handle the event in a number of ways. During event handling, you have access to information about the event from a variable known as an event object.

And when you need to share information between an application's components, you can create and dispatch your own custom events to move information and data around the application as needed.

This chapter describes the Flex event architecture: how to find out what events occur and when, what data you can get from them, and how to build your own event architecture.

Note

To use the ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required