|
There are
three parts to this flash calendar.
The first part is the swf file (i.e.:
the flash file). This contains all the graphics and actionscript to build
the calendar. It uses functionality built into Flash 4 so you will need
the Flash 4 plug-in to view it and if you wish to modify the source file
you will need version 4 of Macromedia's Flash application.
It makes
use of the duplicate movie clip feature in Flash 4 to create the calendar
for each month. It starts with the first day of the month (a blue square)
and works through a loop duplicating and repositioning the square for
each day in the month.
It uses
a Julian date calculation to ensure that the month begins on the correct
weekday.
It is
passed the current date via Javascript (or ASP) in the html page and
displays the current month and year and highlights the current day.
It reads
from a text file called cal.txt the details for whats on for each day
and highlights those days that have something recorded against them. If
the user clicks on a day that has something recorded against it, the details
will be displayed in the box next to the calendar. The use of this text
file means that it is very easy to maintain - if you want to add a new
event to the calendar, you simply add a new line in the text file and
reupload it to your web server - no need to modify the flash file. See
the section 'the text file format' below for more information.
There are quite a few comments within the actionscript so hopefully you
will be able to understand whats going on.
The second
part of the calendar is the html file. It is important to use
this file not a html file created during publish in flash because this
file contains extra Javascript code to pass the current day, month and
year to the swf file. The Javascript code is a modified version of code
provided by Matt Wobensmith of Macromedia Technical support.
We cant
really guarantee that this code will work under all circumstances -
if you find that the flash file is stuck on the getting data frame then
it is probably because the Javascript has not successfully passed the
date to the flash file. Javascript tends to perform a little strangely
in some environments - such as on the Mac and with older browsers. The
most reliable solution may be to use a bit of server scripting (eg:
Perl or ASP) to pass the current date to the swf. See above for ASP
version.
The third
part of the calendar is the text file. This contains the details
of whats on each day in the calendar. The calendar works such that you
need only enter something in the text file if there is something on that
day. ie: you dont need to put blank entries in if there is nothing.
Please
Note: you can also put event details in the flash file as standard
set variable statements - in the file provided there are three
sample entries in the actionscript on the first frame of the movie - you
may wish to delete or change these.
|