-
Book Overview & Buying
-
Table Of Contents
-
Feedback & Rating

Flex 3 with Java

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.
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...
Change the font size
Change margin width
Change background colour