User Guide

DateField.close() 445
Example
The following example, written on a frame of the timeline, sends a message to the Output
panel when a date field called
my_df is changed. The first line of code creates a listener object
called
dfListener. The second line defines a function for the change event on the listener
object. Inside the function is a
trace() statement that uses the event object that is
automatically passed to the function, in this example
evt_obj, to generate a message. The
target property of an event object is the component that generated the event—in this
example,
my_df. The DateField.selectedDate property is accessed from the event objects
target property. The last line calls EventDispatcher.addEventListener() from my_df
and passes it the
change event and the dfListener listener object as parameters.
// 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.