User Guide

DateField.pullDown 455
The second usage example uses an on() handler and must be attached directly to a DateField
instance. The keyword
this, used inside an on() handler attached to a component, refers to
the component instance. For example, the following code, attached to the date field
my_df,
sends “_level0.my_df” to the Output panel:
on (open) {
trace(this);
}
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 opened. The message ends with the index number for
the current month. The first line of code creates a listener object called
dfListener. The
second line defines a function for the
open 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 open
event and the
dfListener listener object as parameters.
// Create listener object.
var dfListener:Object = new Object();
dfListener.open = function(evt_obj:Object){
trace("PullDown Opened" + evt_obj.target.displayedMonth);
}
// Add listener object to DateField.
my_df.addEventListener("open", dfListener);
DateField.pullDown
Availability
Flash Player 6 (6.0.79.0).
Edition
Flash MX Professional 2004.
Usage
dateFieldInstance.pullDown