Share on Google+Share on Google+

DateChooser in Flex4

Advertisement
The DateChooser control is a MX component. It has no Spark component. The DateChooser control contains the year, a month and a grid of the day of the month.

DateChooser control in flex4:

The DateChooser control is a MX component. It has no Spark component. The DateChooser control contains the year, a month and a grid of the day of the month. It has columns labeled for the days of the week. It is very useful for choose a date. This component likes a continually visible calendars.
You can change a month by left or right arrow. Only single date can be selected at a time from the grid. The tag of DateChooser control is <mx:DateChooser>.

Example:

<?xml version="1.0"?>

<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"

xmlns:s="library://ns.adobe.com/flex/spark"

xmlns:mx="library://ns.adobe.com/flex/mx">

<fx:Script>

<![CDATA[

import mx.events.CalendarLayoutChangeEvent;

public function formatdate(Obj:CalendarLayoutChangeEvent):void {

date.text= (Obj.currentTarget.selectedDate.getMonth() + 1) +

"/" + (Obj.currentTarget.selectedDate.getDate() +

"/" +Obj.currentTarget.selectedDate.getFullYear());

}

]]>

</fx:Script>

<s:Panel title="DateChooser Control Example" width="198" height="288">

<mx:DateChooser id="date1" change="formatdate(event)" x="9" y="39" width="177"/>

<s:Label text="Selected Date:" x="10" y="11"/>

<s:TextInput id="date" x="93" y="7" width="93"/>

</s:Panel>

</s:Application>

This is example for DateChooser control. Please choose a date from DateChooser control.

Output:

Running Application:

To view this page ensure that Adobe Flash Player version 10.0.0 or greater is installed.

Download this code

Advertisements

Posted on: May 17, 2010 If you enjoyed this post then why not add us on Google+? Add us to your Circles

Share this Tutorial Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.