Spark Components Documentation
Table Of Contents
Table Of ContentsAuthor: James Peek
Last Modified: 2003/2/18
Generator: gModeler.com.
Availability
Flash Player 6.
Availability
Flash Player 6.
Usage
new SparkEventsCalendar()
Parameters
None.
Returns
Nothing.
Description
A Flash MX component designed for displaying events that occur in a variety of different patterns including once-off, weekly, monthly and yearly recurring. The design is easily reskinned, and the event data easily extended.
Some example events might be: an event which occurs on the last weekday of September, or one which happens on the 3rd Tuesday of every second month between 9am and 5pm.
Example
SparkEventsCalendar Properties
None.
SparkEventsCalendar Methods
setDataProvider : void
Availability
Flash Player 6.
Usage
SparkEventsCalendar
.setDataProvider(dataSet
)
Parameters
dataSet
An array of event objects. (Array)
Returns
Nothing.
Description
Method; Sets an array of event objects.
The following are the required attributes within an event object:
startDate (dateObj)
Date the event starts.
endDate (dateObj)
Date the event ends.
eventType (string: "once", "weekly", "monthly", "yearly")
Define what kind of event it is.
pattern (xmlObj)
Defines recurring event patterns. Valid XML structures as follows:
eventType == "weekly" : recur, sun, mon, tue, wed, thu, fri, sat
eventType == "monthly" : recur, date
eventType == "monthly" : recur, day, week
eventType == "yearly" : date, month
eventType == "yearly" : day, week, month
Where data types defined as:
recur = [1-10] : time between recurrance
sun, mon tue, wed, thu, fri, sat = [0-1] : boolean for day in pattern
date = [0-31] : date of recurrance
day = [mon-sun,day,weekday,weekendday] : day of recurrance
week = [0-5] : week of recurrance
month = [0-11] : month of recurrance
Example
event1 = new Object(); // define a once off event like a 1st of April Party
event1.startDate = new Date(2002,3,1);
event1.endDate = new Date(2002,3,1);
event1.eventType = "once";
event2 = new Object(); // define a monthly recurring event such as a board meeting
event2.startDate = new Date(2003,0,1);
event2.endDate = new Date(2003,11,31);
event2.eventType = "monthly";
event2.pattern = new XML('<pattern recur="1" day="weekday" week="5" />').firstChild; // last week day of the month
event3 = new Object(); // define a yearly recurring event such as a birthday
event3.startDate = new Date(1976,8,27);
event3.endDate = new Date(2070,11,31);
event3.eventType = "yearly";
event3.pattern = new XML('<pattern date="27" month="8" />').firstChild; // every 27th September
myEvents = new Array(event1, event2, event3);
myCalendar.setDataProvider(myEvents);
myCalendar.setDisplayRange({begin:new Date(1999,0),end:new Date(2005,11)}); // set the range of dates to display
setDate : void
Availability
Flash Player 6.
Usage
SparkEventsCalendar
.setDate(displayDate
)
Parameters
displayDate
Month to be display in the calendar. (Date)
Returns
Nothing.
Description
Method; Sets the month which will be displayed.
Example
myCalendar.setDate(new Date(2003,3)); // set the month to display to April 2003
myCalendar.setDisplayRange({begin:new Date(1999,0),end:new Date(2005,11)}); // set the range of dates to display
setDisplayRange : void
Availability
Flash Player 6.
Usage
SparkEventsCalendar
.setDisplayRange(dateRange
)
Parameters
dateRange
Range of dates to be displayed. (Object)
Returns
Nothing.
Description
Method; Sets the minimum and maximum dates which can be viewed in the calendar.
dateRange
is an object containing the attributes begin
and end
both of which are Date objects.
Example
var range = new Object();
range.begin = new Date(1999,0); // Jan 1999
range.end = new Date(2005,11); // Dec 2005
myCalendar.setDisplayRange(range);
setEnabled : void
Availability
Flash Player 6.
Usage
SparkEventsCalendar
.setEnabled(enableFlag
)
Parameters
enableFlag
Boolean value that enables the component if true. (Boolean)
Returns
Nothing.
Description
Method; Enables or disables the calendar.
Example
myCalendar.setEnabled(false);
SparkEventsCalendar Events
onDisplayEvent : void
Availability
Flash Player 6.
Usage
SparkEventsCalendar
.onDisplayEvent(eventsData,dateObj
)
Parameters
eventsData
Array of event objects that fall on the selected day. (Array)
dateObj
The date of the selected day. (Date)
Returns
Nothing.
Description
Event Handler; Invoked when a date with events is clicked.
An array of event objects and the selected date are returned to the function so that detailed information can be presented to the user.
Example
myCalendar.onDisplayEvent = function (eventsData,dateObj) {
trace(dateObj.toString() + ":" + .geteventsData[0].startDate);
}
onHideEvent : void
Availability
Flash Player 6.
Usage
SparkEventsCalendar
.onHideEvent()
Parameters
None.
Returns
Nothing.
Description
Event Handler; Invoked when the calendar has no event to display.
Example
myCalendar.onHideEvent = function () {
trace("No events to be display now.");
}
onSelectDate : void
Availability
Flash Player 6.
Usage
SparkEventsCalendar
.onSelectDate(dateObj
)
Parameters
dateObj
dateObj parameter. (Date)
Returns
Nothing.
Description
Event Handler; Invoked when a date with events is clicked.
The selected date is returned to the function.
Example
myCalendar.onSelectDate = function (dateObj) {
trace("Date without events pressed: " + dateObj.toString());
}
SparkEventsCalendar Associations
None.