Search icon
Subscription
0
Cart icon
Close icon
You have no products in your basket yet
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Flex 3 with Java

You're reading from  Flex 3 with Java

Product type Book
Published in Jun 2009
Publisher Packt
ISBN-13 9781847195340
Pages 304 pages
Edition 1st Edition
Languages

Table of Contents (18) Chapters

Flex 3 with Java
Credits
About the Author
About the Reviewers
1. Preface
1. Installing and Configuring Adobe Flex 2. Introduction to Flex 3 Framework 3. Introduction to ActionScript 3.0 4. Using External API and LocalConnection 5. Working with XML 6. Overview of LiveCycle Data Services and BlazeDS 7. Flex Data Access Methods 8. Communicating with Server-side Java 9. Debugging Techniques 10. Styling your Application 11. Packaging and Deployment 12. Internationalization and Localization 13. Creating an E-commerce Application

Working with events


In a previous chapter, you saw how to work with events in MXML. Now, in this section, you will learn how to work with events in ActionScript. The event model in ActionScript 3.0 is based on the Document Object Model (DOM) Level 3 event specification (http://www.w3.org/TR/DOM-Level-3-Events/events.html). This model provides a very powerful, yet intuitive, event handling tool for Flex developers.

Registering event handlers

Flash Player dispatches event objects whenever an event occurs. Every component has different events associated with it and in order to handle these events you need to register the event handler or event listener with specific events using the addEventListener() method. This is the syntax of addEventListener():

displayObj.addEventListener(type:String,listener:Function,useCapture:Boolean=false,priority:int=0,useWeakReference:Boolean=false):void

For example:

myButton.addEventListener(MouseEvent.CLICK, clickHandler);

The addEventListener() method takes...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime}