Chapter 7. ADDING INTERACTION WITH ACTIONSCRIPT

IN THIS CHAPTER

Understanding Events

Common Events

Researching Events

Listening for and Responding to Events

Collision! A Whirlwind of Events

Summary

Software users excel at initiating interaction. Their techniques include mouse movement, clicking, dragging and dropping, and keyboard entry, to name a few.

For you, the Flex developer, “the trick” isn’t programming each individual event interaction as much as it is “seeing the big picture,” or specifically, knowing what interactions and events the framework exposes and the relatively few techniques used to weave them into your application.

In this chapter, we review the most common events; we also teach you how to research events in the official documentation. After we finish discussing the background information, we demonstrate how to handle events in your programs, and for the grand finale, we develop a simple, yet surprisingly fun game called Collision! (Figure 7-1 and Figure 7-2), which we hope will inspire you through the rest of this book.

Collision!: 3 files, 190 lines of code, 1 timeless classic
Figure 7-1. Collision!: 3 files, 190 lines of code, 1 timeless classic
Keeping it real with grammar from the Nintendo days
Figure 7-2. Keeping it real with grammar from the Nintendo days

Understanding Events

Flex applications listen for and respond to events. An event is something that happens either by direct ...

Get Learning Flex 4 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.