Previous Page
Next Page

Tripod >> 3pod Tips & Learning and manuals for educations

Recipe 14.2. Performing Actions When the User Makes a Date Selection

Problem

You want Flash to perform some actions when the user chooses a value from a date chooser or a date field.

Solution

Define a listener object with a change() method.

Discussion

Both the date chooser and date field dispatch a change event when the user selects a date value. Thus you can use a listener object to detect the change event and perform some actions when that occurs. For example, if you are using a date chooser to allow the user to select a date for which he or she wants to see a schedule, you may want the event to cause Flash to display some corresponding schedule information in a text area.

In the following code, a listener object is defined and registered such that when the user makes a selection from a date chooser named cdcSchedule, the selected date is displayed in the Output panel:

	var oListener:Object = new Object();
	oListener.change = function(oEvent:Object):Void {
	  trace(oEvent.target.selectedDate);
	};
	cdcSchedule.addEventListener("change", oListener);

For more details on using a listener object as well as the parameter passed to the listener object's method, see Recipe 14.1.

See Also

Recipe 14.1, Recipe 13.9, Recipe 13.16

Tripod >> 3pod Botom Tips & Learning and manuals for educations

Previous Page
Next Page

 

bluedot bluedots greydots pinkdots

Tripod >> 3pod Tips & Learning and manuals for educations