Putting the Application Together
The final step in creating a working scheduler application is to create the main code routine on the main timeline of the Flash document. Essentially, the main routine is responsible for three things:
Creating an instance of Macromedia’s Calendar component (the FCalendarSymbol must be available in the Library)
Creating an instance of the Schedule component
Creating functionality that opens a schedule item that corresponds to a calendar date when the calendar date is double-clicked
All you need to do to complete the scheduler application is add the following code to the first frame of the default layer of the Flash document’s main timeline:
// IncludeDrawingMethods.as
from Chapter 4. #include "DrawingMethods.as" // IncludeMovieClip.as
from Chapter 7 andTextField.as
from Chapter 8. #include "MovieClip.as" #include "TextField.as" // IncludeDate.as
from Chapter 10 andTables.as
from Chapter 11. #include "Date.as" #include "Table.as" function init( ) { // Create an instance of the Calendar component. _root.attachMovie("FCalendarSymbol", "cal", _root.getNewDepth( )); cal.setChangeHandler("onSelectDate"); cal.setSize(Stage.width, Stage.height); // Create a Schedule component instance. _root.attachMovie("ScheduleSymbol", "scheduler", _root.getNewDepth( )); scheduler.setOnClose("onScheduleClose", _root); } // TheonSelectDate( )
function is the callback function for the Calendar component. function onSelectDate(cmpt) { // Get the time, in milliseconds, since ...
Get Actionscript Cookbook now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.