|
Hi Kay,
Thanks for sharing the code.
George
--->>> [EMAIL PROTECTED] 10/10/03 9:54:32 >>> Hi, For people who asked to see the calendar code from my RIA entry, here 'tis (sorry it's a bit late): The calendar component was the Advanced version from DRK2, but I wasn't actually using any of the advanced features of it - just the standard stuff that's also in the basic calendar, I believe. Hey, I had great plans but not enough time... Here's the code for setting up the calendar - as all the events covered by my app were held between Jan and March 2003, I limited the calendar to only allowing dates from that period to be show/selected using the setDateRange function: var range = new Object(); range.begin = new Date(2003, 0, 1); range.end = new Date(2003, 2, 31); eventCalendar.setDisplayRange(range); Then, I had to set the dates that would be initially selected (the entire range) by looping over each month and adding them to an array. I think there must be a better way to do this - in fact I'm sure of it! If anyone has any ideas, please let me know... dateRangeArray = new Array(); //hard-code the dates to select - not the best but will do for now for (d = 1; d < 32; d++){ dateRangeArray[d] = new Date(2003, 0, d); } for (e = 1; e < 29; e++){ ee = e + 32; dateRangeArray[ee] = new Date(2003, 1, e); } for (f = 1; f < 32; f++){ ff = f + 61; dateRangeArray[ff] = new Date(2003, 2, f); } eventCalendar.setSelectedItems(dateRangeArray); Next I set what month was initially displayed when the calendar loaded. There's actually a bug in the component, where it always will show the current month, ignoring this property, unless it's set on a different frame, so I set it here (in case the bug ever gets fixed) and also on frame 10, which is where the code jumped to everytime it needed to so something: eventCalendar.setDisplayedMonth(new Date(2003, 0, 1)); The event handler for the calendar was the same as for the categories list box. The problem I had here was the Flash sends dates in UTC format, with the date plus the offset from GMT of the current time zone. No matter what I did in CF (dateformat, parsedate, the LS date functions), the date always ended up as 2002 instead of 2003. So, I asked on the fugli list and someone there (I think it was someone there) pointed me to http://darronschall.com/weblog/archives/000040.cfm - where a dateformat function saved my life. eventCalendar.setChangeHandler("onFilterChange"); > // get all selected items from the categories list box var categoriesArray = categories_lb.getSelectedItems(); var categoriesList = "0"; for (var iCount=0; iCount<categoriesArray.length; iCount++){ categoriesList = categoriesList + "," + categoriesArray[iCount]["data"]; } // get all selected dates from the calendar var datesArray = eventCalendar.getSelectedItems(); // use the dateformat function to convert each date to something CF will understand var datesList = dateFormat(new Date(2000,0,1),"mm/dd/yyyy"); for(i=0; i<datesArray.length; i++){ datesList = datesList + "," + dateFormat(datesArray[i],"mm/dd/yyyy"); } // call the CFC with the list of categories and list of dates as parameters FestivalService.getEventsByCategory(categoriesList,datesList); } And that's basically it! Don't ask any hard questions, because I *really* don't know what I'm doing, actually. Cheers! Kay. --- You are currently subscribed to cfaussie as: [EMAIL PROTECTED] To unsubscribe send a blank email to [EMAIL PROTECTED] MX Downunder AsiaPac DevCon - http://mxdu.com/ You are currently subscribed to cfaussie as: [EMAIL PROTECTED] To unsubscribe send a blank email to [EMAIL PROTECTED] MX Downunder AsiaPac DevCon - http://mxdu.com/ AMES (Adult Multicultural Education Services) www.ames.net.au Disclaimer ********************************************************************** This email and any attachments may be confidential. If received in error, please contact us and delete all copies. Before opening or using attachments you should check them for viruses or defects. Regardless of any loss, damage or consequence, whether caused by the negligence of the sender or not, resulting directly or indirectly from the use of any attached files our liability is limited to resupplying any affected attachments. Any representations or opinions expressed are those of the individual sender, and not necessarily those of Adult Multicultural Education Services (AMES). ********************************************************************** --- You are currently subscribed to cfaussie as: [EMAIL PROTECTED] To unsubscribe send a blank email to [EMAIL PROTECTED] MX Downunder AsiaPac DevCon - http://mxdu.com/ |
- [cfaussie] Re: Flash calendar code Hilary Bridel
- George Lu
