Hello, Remember the 9k Calendar? With the New Year coming, I realised that my 9k XML SWF calendar needed a few updates. What started off as an experiment with Flash 5's XML capabilities, turned out to be a popular module, and I have received several requests for the source code. As there are a few of you using the calendar on your site - and the new-year is coming - you may be interested in this update. This year I have updated the calendar with a more robust XML loading mechanism, that includes an error message if there is a load failure. Also, I have made it easier to have more than one year at a time for your events. You must now declare a range of years in an external text file (extVars.txt), and have a separate xml file for each year (eg events2002.xml, events 2003.xml, etc) - each of which loads as it is needed. Added to this, it is now easier to retrieve the XML dynamically from an ASP or PHP file. You can pass the relevant parameters via a query string to the server. You may want to createa mySQL or some sort of database backend to this, that can be edited by an admin system. Here is a summary of the few changes.... 1. there is an external text file that loads the date range called extVars.txt. This must include the first year of your date range, the final year, and a variable to indicate that the external variables have loaded. Flash loads the variables like they are a query string. The contents of the file should look something like this: firstyear=2000&finalyear=2003&extVarsLoaded=true 2. each year of events is contained in a separate XML file. These should at least contain some valid XML, otherwise they will not load and you will get an error. They should be named following the same convention I have used: eg events2002.xml 3. The XML loading is handled away from the main movie timeline, and provides an error message when there is a load error. You shouldn't have to worry about how this works - but pick it apart if you are wanting to learn how I did it. I have also added a function (taken from http://www.moock.org) that strips out whitespace in the XML, so it is no longer necessary to do this manually as described below. 4. The colour scheme has changed, just to reflect the new version. Please make your own skins for this calendar, and if you publish it, think about providing alink back to my site. 5. The events for 2002 have been updated. Follow the syntax and naming conventions I have used, and it should all go well. I have to say thanks to Colin Moock, who wrote Actionscript, The Definative Guide (O'Reilly), and I recommend it to anyone who takes their Actionscript seriously. Also check the Moock site for helpful bits of code: http://www.moock.org/ Regards, -ad http://www.admataz.com adam@admataz.com 10 Dec 2001 original readme follows - it is still relevant: - - - - - - - Thanks to all those who showed an interest in the 9kCalendar. Herewith are the source files you asked for. I hope they're of help. Below are some important points to note when making changes... You'll need Flash 5 to open/edit the movie and view the source. For Flash tutorials and info, try http://www.flashkit.com/ If you only want to make changes to the dates, and keep the calendar as it is, you only need to edit the XML file. Just be sure to always name your file "events.xml" and keep it in the same folder as your .swf. You can edit the XML with a text editor, or use something like Microsoft XML Notepad (available as a free download: http://msdn.microsoft.com/xml/NOTEPAD/intro.asp). Added 10.JUN.2001: Following a request, I added the ability to have a "link" attribute for each event - which will, when present, make the event title in the right panel a link to whichever website you define as a value for the attribute. Leave off the "http://" - the flash movie includes that already. So for example, if you want to link to http://www.admataz.com from a day, your xml could look like this: ****Notes**** WHITESPACE some versions of the Flash 5 Player Plugins will not be happy with any whitespace in the XML file. I have removed all whitespace for this XML file - so there are no linebreaks or spaces between the XML elements. BBEdit on a Mac (http://www.barebones.com) makes it very easy to format your document heirarchically - and compact it again when you're finished editing. For Windows, you can use Advanced HTML Optimizer - http://www.pcbit.com/htmlopt/ which will work for XML files too. For both, you may need to still remove the single space between each tag. (Search and replace "> <" for "><"). Otherwise there are some .FLA files on Flashkit that have functions to strip out the whitespace in your XML file using ActionScript - and a rather good one on http://www.moock.org/ SPECIAL CHARACTERS For special characters in the content (such as accents, or "foreign" characters - ie. foreign to Americans) Flash needs them to be "url encoded". Refer to "url_encoding.html" (also attached) for the codes to these special characters. You can change the values of the attributes and the text in any of the "event" elements, or you can add/delete events. But be sure to keep all the "month" elements, even if they have no events. And the attribute names should be kept the same and the XML well formed. If you are unsure of any XML stuff, try http://www.builder.com/Authoring/XmlSpot/ or http://www.xml.com/ or http://www.projectcool.com/ good luck. -ad adam@admataz.com http://www.admataz.com