Usage
Usage 1:
on(close){
...
}
Usage 2:
listenerObject = new Object();
listenerObject.close = function(eventObject){
...
}
myDF.addEventListener("close", listenerObject)
Description
Event; broadcast to all registered listeners when the DateChooser subcomponent closes after a
user clicks outside the icon or selects a date.
The first usage example uses an
instance. The keyword
component instance. For example, the following code, attached to the date field
"_level0.myDF" to the Output panel:
on(close){
trace(this);
}
The second usage example uses a dispatcher/listener event model. A component instance (
dispatches an event (in this case,
handler, on a listener object (
same name as the event on the listener object; the method is called when the event is triggered.
When the event is triggered, it automatically passes an event object (
object method. Each event object has properties that contain information about the event. You
can use these properties to write code that handles the event. Finally, you call the
EventDispatcher.addEventListener()
the event to register the listener with the instance. When the instance dispatches the event, the
listener is called.
For more information, see
Example
This example, written on a frame of the Timeline, sends a message to the Output panel when the
date chooser in
myDF
line defines a function for the
statement that uses the event object that is automatically passed to the function, in this example
, to generate a message. The
eventObj
generated the event—in this example,
property. The last line calls
target
passes it the
close
handler and must be attached directly to a DateField
on()
, used inside an
this
) and the event is handled by a function, also called a
close
listenerObject
"EventDispatcher class" on page
closes. The first line of code creates a listener object called
event on the listener object. Inside the function is a
close
target
myDF
EventDispatcher.addEventListener()
event and the
listener object as parameters.
form
handler attached to a component, refers to the
on()
) that you create. You define a method with the
method on the component instance that broadcasts
415.
property of an event object is the component that
. The property is accessed from the event object's
DateField component (Flash Professional only)
, sends
myDF
) to the listener
eventObject
. The second
form
trace()
from
myDF
)
myDF
and
377
Need help?
Do you have a question about the FLASH MX 2004-USING COMPONENTS and is the answer not in the manual?
Questions and answers