Share on Google+Share on Google+

DateField in Flex

Advertisement
In the current tutorial you will come to know about the DateField control of Flex. We use tag to use this control in our programming, we can assign an id to it for referencing from the same MXML file or from any other ActionScript file. The examples will help you to learn DateField more effectively

The DateField in Flex:

We use <mx:DateField> tag to use this control in our programming, we can assign an id to it for referencing from the same MXML file or from any other ActionScript file.

DateField control is a text field with a calendar icon at it's right side. If we click either on the text box or on the icon, a calendar appears on the screen.

When the calendar appears, we can select the month and year with the help of navigation keys. If we do not select any date then the text box remains blank.


Example:

<?xml version="1.0" encoding="utf-8"?>

<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">

<mx:Script>

<![CDATA[

private function selectDate(date:Date):String{

return dform1.format(date);

}

]]>

</mx:Script>

<mx:DateFormatter id="dform1" formatString="DD/MM/YYYY" />

<mx:DateField disabledRanges="{[{rangeEnd: new Date(2009,11,31)}]}" id="dfield1" labelFunction="selectDate" parseFunction="null" width="110" horizontalCenter="10" verticalCenter="10" paddingLeft="10" paddingRight="10"/>

</mx:Application>


Output:

Advertisements

Advertisement

Posted on: January 28, 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.