Ok, you have the selected date in the click handler.

 

Now, use that value to select the associated node in your xml "shows",
using an e4x expression. Assign that node to a [Bindable] instance
variable.  Bind you UI components to the xml in that variable.

 

Tracy

 

________________________________

From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of Sal H.
Sent: Friday, July 25, 2008 2:31 PM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Re: Calendar Help

 

Help with the actionscript please. I only got as far as this:

<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml
<http://www.adobe.com/2006/mxml> "
layout="vertical" creationComplete="init()">
<mx:Script>
<![CDATA[
import mx.events.CalendarLayoutChangeEvent;
import mx.controls.Alert;

private function init():void {
dc1.displayedMonth = 1;
dc1.displayedYear = 2008;
} 

public function displayDates():void {
var dateRanges:Array = [];
for (var i:int=0; i<shows.show.length(); i++) { 
var cDate:Date = 
new Date(shows.show[i].showDate.toString()); 

var cDateObject:Object = 
{rangeStart:cDate, rangeEnd:cDate};
dateRanges.push(cDateObject);
}
dc1.selectedRanges = dateRanges;
} 

private function
clickDate(eventObj:CalendarLayoutChangeEvent):void {
// Make sure selectedDate is not null.
if (eventObj.currentTarget.selectedDate == null) {
return 
}

//Access the Date object from the event object. 
Alert.show(eventObj.currentTarget.shows.showDate.toString());
} 
]]>
</mx:Script>

<!-- Define the data for the DateChooser --> 
<mx:XML id="shows" format="e4x">
<data>
<show>
<showID>1</showID>
<showDate>02/28/2008</showDate>
<showTime>10:45am/11:15am</showTime>
</show>
<show>
<showID>2</showID>
<showDate>02/23/2008</showDate>
<showTime>7:00pm</showTime>
</show>
</data>
</mx:XML>

<mx:DateChooser id="dc1" 
showToday="false" 
creationComplete="displayDates()"
change="clickDate(event)"/>

--- In flexcoders@yahoogroups.com <mailto:flexcoders%40yahoogroups.com>
, "Tracy Spratt" <[EMAIL PROTECTED]> wrote:
>
> How about doing that in a DateChooser.change event handler function?
> 
> Tracy
> 
> 
> 
> ________________________________
> 
> From: flexcoders@yahoogroups.com <mailto:flexcoders%40yahoogroups.com>
[mailto:flexcoders@yahoogroups.com <mailto:flexcoders%40yahoogroups.com>
] On
> Behalf Of emobilecat
> Sent: Friday, July 25, 2008 11:41 AM
> To: flexcoders@yahoogroups.com <mailto:flexcoders%40yahoogroups.com> 
> Subject: [flexcoders] Calendar Help
> 
> 
> 
> Hi all 
> 
> I'm trying to create a calendar using the dateChooser component. I am
> able to show which dates are selectable, but I can't figure out how to
> when I click on the date it will show the event information for that
> day from the xml file I provided. Help please!
> 
> Here's a snippet of what I have so far:
> 
> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml
<http://www.adobe.com/2006/mxml> 
> <http://www.adobe.com/2006/mxml <http://www.adobe.com/2006/mxml> > "
> creationComplete="init()">
> <mx:Script>
> <![CDATA[
> private function init():void {
> dc1.displayedMonth = 1;
> dc1.displayedYear = 2008;
> } 
> 
> public function displayDates():void {
> var dateRanges:Array = [];
> for (var i:int=0; i<shows.show.length(); i++) { 
> var cDate:Date = 
> new Date(shows.show[i].showDate.toString()); 
> 
> var cDateObject:Object = 
> {rangeStart:cDate, rangeEnd:cDate};
> dateRanges.push(cDateObject);
> }
> dc1.selectedRanges = dateRanges;
> } 
> ]]>
> </mx:Script>
> 
> <mx:XML id="shows" format="e4x">
> <data>
> <show>
> <showID>1</showID>
> <showDate>02/28/2008</showDate>
> <showTime>10:45am/11:15am</showTime>
> </show>
> <show>
> <showID>2</showID>
> <showDate>02/23/2008</showDate>
> <showTime>7:00pm</showTime>
> </show>
> </data>
> </mx:XML>
> 
> <mx:DateChooser id="dc1" showToday="true" 
> creationComplete="displayDates()"/>
> 
> </mx:Application>
>

 

Reply via email to