Chapter 7. Working with Events

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 sample code for this chapter, import the chapter07.zip Flex project archive file from the Web site files into your Flex Builder workspace.

The Flex Event Architecture

The ActionScript objects you use to build Flex applications communicate with each other ...

Get Adobe® Flex® 3 Bible now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.