ajwei810192
03-18-2009, 10:09 PM
Hi, Guys:
I have a snippet of code that I have modified from http://flexpearls.blogspot.com/2008/03/datechooser-with-support-for.html. I am trying to do the similar thing, only I am trying to specify the dates in the internal XML.
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
xmlns="*" layout="vertical" width="400" height="300"
creationComplete="generateDates()">
<mx:Script>
<![CDATA[
import mx.core.mx_internal;
import mx.formatters.DateFormatter;
import mx.controls.Alert;
[Bindable]
private var date3:XML =
<dates>
<date id="1" value="2009/03/12"/>
<date id="2" value="2009/03/22"/>
<date id="3" value="2009/04/02"/>
</dates>
private function generateDates():void
{
var input:Array = [];
var today:Date = new Date();
//let us generate random special dates for previous 2 months from today
for (var i:int = 0; i <=3; i++)
{
var date:String= date3.date.@value.toString();
var date2:Array= date.split("/");
var month:Number= parseInt(date2[1])-1;
var year:Number= parseInt(date2[0]);
var day:Number= parseInt(date2[2]);
input.push(new Date(year, month, day))
}
dch.specialDates = input;
}
]]>
</mx:Script>
<mx:DateChooser id="dch" selectionIndicatorSkin="mx.skins.halo.DateChooserIndicator"
specialDates="{input}" specialDatesColors="0xFF8040"
allowDisjointSelection="true" allowMultipleSelection="true"/>
</mx:Application>
I have got the right dates added, but it looks like the dates are never displaying. Could anyone please give me some pointers on this?
Thanks in advance.
I have a snippet of code that I have modified from http://flexpearls.blogspot.com/2008/03/datechooser-with-support-for.html. I am trying to do the similar thing, only I am trying to specify the dates in the internal XML.
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
xmlns="*" layout="vertical" width="400" height="300"
creationComplete="generateDates()">
<mx:Script>
<![CDATA[
import mx.core.mx_internal;
import mx.formatters.DateFormatter;
import mx.controls.Alert;
[Bindable]
private var date3:XML =
<dates>
<date id="1" value="2009/03/12"/>
<date id="2" value="2009/03/22"/>
<date id="3" value="2009/04/02"/>
</dates>
private function generateDates():void
{
var input:Array = [];
var today:Date = new Date();
//let us generate random special dates for previous 2 months from today
for (var i:int = 0; i <=3; i++)
{
var date:String= date3.date.@value.toString();
var date2:Array= date.split("/");
var month:Number= parseInt(date2[1])-1;
var year:Number= parseInt(date2[0]);
var day:Number= parseInt(date2[2]);
input.push(new Date(year, month, day))
}
dch.specialDates = input;
}
]]>
</mx:Script>
<mx:DateChooser id="dch" selectionIndicatorSkin="mx.skins.halo.DateChooserIndicator"
specialDates="{input}" specialDatesColors="0xFF8040"
allowDisjointSelection="true" allowMultipleSelection="true"/>
</mx:Application>
I have got the right dates added, but it looks like the dates are never displaying. Could anyone please give me some pointers on this?
Thanks in advance.