...
}
Usage 2:
listenerObject = new Object();
listenerObject.scroll = function(eventObject){
...
}
myDC.addEventListener("scroll", listenerObject)
Description
Event; broadcast to all registered listeners when a month button is clicked.
The first usage example uses an
instance. The keyword
component instance. For example, the following code, attached to the date chooser
"_level0.myDC" to the Output panel:
on(scroll){
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. The scroll event's event object has an
additional property,
,
previousMonth
nextYear
Finally, you call the
instance that broadcasts 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 a
month button is clicked on a DateChooser instance called
listener object called
object. Inside the function is a
passed to the function, in this example
an event object is the component that generated the event—in this example,
calls
EventDispatcher.addEventListener()
listener object as parameters.
form
form = new Object();
form.scroll = function(eventObj){
trace(eventObj.detail);
handler and must be attached directly to a DateChooser
on()
, used inside an
this
) and the event is handled by a function, also called a
scroll
listenerObject
, that can have one of the following values:
detail
,
previousYear
EventDispatcher.addEventListener()
"EventDispatcher class" on page
. The second line defines a function for the
form
statement that uses the event object that is automatically
trace()
eventObj
handler attached to a component, refers to the
on()
) that you create. You define a method with the
.
method on the component
415.
. The first line of code creates a
myDC
, to generate a message. The
from
and passes it the
myDC
DateChooser component (Flash Professional only)
, sends
myDC
) to the listener
eventObject
,
nextMonth
event on the listener
scroll
property of
target
. The last line
myDC
event and the
scroll
)
myDC
363
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