Example
The following example, written on a frame of the timeline, sends a message to the Output
panel when a date field called
called
. The second line defines a function for the
dfListener
object. Inside the function is a
automatically passed to the function, in this example
property of an event object is the component that generated the event—in this
target
example,
. The
my_df
property. The last line calls
target
and passes it the
change
// Create listener object.
var dfListener:Object = new Object();
dfListener.change = function(evt_obj:Object){
var thisDate:Date = evt_obj.target.selectedDate;
trace("date selected: " + thisDate);
}
// Add listener object to DateField.
my_df.addEventListener("change", dfListener);
DateField.close()
Availability
Flash Player 6 (6.0.79.0).
Edition
Flash MX Professional 2004.
Usage
dateFieldInstance.close()
Returns
Nothing.
Description
Method; closes the pop-up menu.
is changed. The first line of code creates a listener object
my_df
statement that uses the event object that is
trace()
DateField.selectedDate
EventDispatcher.addEventListener()
event and the
dfListener
change
, to generate a message. The
evt_obj
property is accessed from the event object's
listener object as parameters.
event on the listener
from
my_df
DateField.close()
445
Need help?
Do you have a question about the FLASH 8-COMPONENTS LANGUAGE and is the answer not in the manual?
Questions and answers