See here for a version with current XML data so you can see it running properly.
Unlike most countdown scripts that count down to a specific LOCAL event (such as New Years Eve), this script counts down to REGION-BASED events by taking into account the viewers timezone, clock setting and by using a GMT (Greenwich Mean Time) offset for each XML entry.
Usually a script will count down to an event such as NYE so no matter where a visitor is located in the world, the countdown will simply count from the visitors CURRENT PC time to NYE (using the same timezone)
However, what if we want to count down to an event that may be located in a DIFFERENT timezone to where the visitor is located? An example would be counting down to the opening of the US Grand Slam Tennis event. If the countdown simply used the visitors PC clock then unless the visitor was in the SAME timezone, the countdown would not accurately reflect a specific point in time when the event has actually started. This utility takes all that into account (dependent of course on correct time and timezone being set on a visitors computer)
- Therefore, this utility takes timezones into account and GMT (Greenwich Mean Time) offsets via a GMT setting within the XML.
- The XML allows for an event range rather than just an event date and time. ie. an event such as the US Open which runs for a couple of weeks can be counted down to the START DATE and TIME, show an “EVENT IN PROGRESS” message for the duration, and once over AUTOMATICALLY BEGIN counting down to the NEXT event in the XML.
- If the timer is left running for an extended time it will automatically move on to counting down to the next event when the current active event expires. (Many countdown timers will stay locked on to the “EVENT IN PROGRESS” message even once the event END DATE and TIME has passed and will neglect to start counting down to the next event.
- This utility uses xfactorstudio XML parsing library and shows some (hard to find) examples of utilising the library
- The framerate of this FLA for BEST accuracy should be set to 1. However changing the framerate to something else will still work perfectly fine. Using a frame based count rather than a setInterval gives best results.
- Is built so that a path to the xml file can be passed in via FlashVars in th HTML source or appended via querystring.
- Further XML attributes could easily be added and then read in via the displayEventInfo() function
How to modify the file:
- There are comments throughout the FLA that explain how the code works and also within the XML
- To test the effect of timezones you can change your PC’s time and/or timezone and effectively see how someone else in a different timezone would see the count down.
- Below is an example event XML entry (please refer to event_data.xml for complete, multiple event example) :
<event startDate="15/1/2007" startTime="10:00" endDate="28/1/2007" endTime="20:00" GMT="11" title="AUSTRALIAN OPEN" image="aus_open" linkGeneric="http://www.australianopen.com" linkOn="http://www.australianopen.com/en_AU/scores/index.html"/>
- dates are in DD/MM/YY format and times use 24 hour time
- GMT :(Greenwich Mean Time) is used to offset these local times to the users local time.
- Info on timezones can be found here : http://www.worldtimezone.com
- Info on Daylight Savings Dates can be found here : http://www.worldtimezone.com/daylight.html
- Daylight savings needs to be taken into account via changing the GMT offset values – when an event is taking place during Daylight Savings (in that events region), add 1 hour to the GMT attribute – for example Melbourne, Australia (where the Aus Open is held) is in timezone GMT +10, but it’s held during Summer with Daylight Savings applied, so add 10+1=11 which is entered below
- title : is displayed as either event we’re counting down to or the event that’s currently active
- image : this actually maps to a frame label wihin the “images” movieclip.
- linkGeneric : can be used to link to a generic event page
- linkOn : can be used to link to the current event’s results page (for example) when an event is active
You MUST put events in the XML in chronological order or else you will get unpredictable results