divingdave24
03-31-2010, 10:40 AM
Hi there,
I'm creating a Formula One countdown movie in Flash MX 2004, which stores the start times of all 19 GPs this season. Then based on the current date it shows how many days, hours, mins and secs to the start of the next race.
I have all the dates/times stored and the race name is passed to the movie via the URL, like this:
embed src="countdown.swf?race=malaysia"
I have a multiple IF and ELSE IF statement that I'm totally convinced is fine, but when I publish the movie it throws up 2 errors.
if (raceLocation == "bahrain") { var targetDate:Date = new Date(currentYear,02,14,12,0,0,0); }
else if (raceLocation == "australia") { var targetDate:Date = new Date(currentYear,02,28,6,0,0,0); }
else if (raceLocation == "malaysia") { var targetDate:Date = new Date(currentYear,03,04,8,0,0,0); }
else if (raceLocation == "china") { var targetDate:Date = new Date(currentYear,03,18,7,0,0,0); }
else if (raceLocation == "spain") { var targetDate:Date = new Date(currentYear,04,9,12,0,0,0); }
else if (raceLocation == "monaco") { var targetDate:Date = new Date(currentYear,04,16,12,0,0,0); }
else if (raceLocation == "turkey") { var targetDate:Date = new Date(currentYear,04,30,12,0,0,0); }
else if (raceLocation == "canada") { var targetDate:Date = new Date(currentYear,05,13,16,0,0,0); }
else if (raceLocation == "europe") { var targetDate:Date = new Date(currentYear,05,27,12,0,0,0); }
else if (raceLocation == "greatbritain") { var targetDate:Date = new Date(currentYear,06,11,12,0,0,0); }
else if (raceLocation == "germany") { var targetDate:Date = new Date(currentYear,06,25,12,0,0,0); }
else if (raceLocation == "hungary") { var targetDate:Date = new Date(currentYear,07,01,12,0,0,0); }
else if (raceLocation == "belgium") { var targetDate:Date = new Date(currentYear,07,29,12,0,0,0); }
else if (raceLocation == "italy") { var targetDate:Date = new Date(currentYear,08,12,12,0,0,0); }
else if (raceLocation == "singapore") { var targetDate:Date = new Date(currentYear,08,26,12,0,0,0); }
else if (raceLocation == "japan") { var targetDate:Date = new Date(currentYear,09,10,06,0,0,0); }
else if (raceLocation == "korea") { var targetDate:Date = new Date(currentYear,09,24,06,0,0,0); }
else if (raceLocation == "brazil") { var targetDate:Date = new Date(currentYear,10,7,16,0,0,0); }
else if (raceLocation == "abudhabi") { var targetDate:Date = new Date(currentYear,10,14,13,0,0,0); }
else { var targetDate:Date = new Date(currentYear,0,1,1,0,0,0); }
When I run this I see this Output error:
**Error** Scene=Scene 1, layer=Actions, frame=1:Line 32: ')' or ',' expected
else if (raceLocation == "italy") { var targetDate:Date = new Date(currentYear,08,12,12,0,0,0); }
**Error** Scene=Scene 1, layer=Actions, frame=1:Line 33: 'else' encountered without matching 'if'
else if (raceLocation == "singapore") { var targetDate:Date = new Date(currentYear,08,26,12,0,0,0); }
I've checked the code a dozen times and I'm sure it's right. Am I going mad or have I overlooked something really simpe?
Thanks,
Dave
I'm creating a Formula One countdown movie in Flash MX 2004, which stores the start times of all 19 GPs this season. Then based on the current date it shows how many days, hours, mins and secs to the start of the next race.
I have all the dates/times stored and the race name is passed to the movie via the URL, like this:
embed src="countdown.swf?race=malaysia"
I have a multiple IF and ELSE IF statement that I'm totally convinced is fine, but when I publish the movie it throws up 2 errors.
if (raceLocation == "bahrain") { var targetDate:Date = new Date(currentYear,02,14,12,0,0,0); }
else if (raceLocation == "australia") { var targetDate:Date = new Date(currentYear,02,28,6,0,0,0); }
else if (raceLocation == "malaysia") { var targetDate:Date = new Date(currentYear,03,04,8,0,0,0); }
else if (raceLocation == "china") { var targetDate:Date = new Date(currentYear,03,18,7,0,0,0); }
else if (raceLocation == "spain") { var targetDate:Date = new Date(currentYear,04,9,12,0,0,0); }
else if (raceLocation == "monaco") { var targetDate:Date = new Date(currentYear,04,16,12,0,0,0); }
else if (raceLocation == "turkey") { var targetDate:Date = new Date(currentYear,04,30,12,0,0,0); }
else if (raceLocation == "canada") { var targetDate:Date = new Date(currentYear,05,13,16,0,0,0); }
else if (raceLocation == "europe") { var targetDate:Date = new Date(currentYear,05,27,12,0,0,0); }
else if (raceLocation == "greatbritain") { var targetDate:Date = new Date(currentYear,06,11,12,0,0,0); }
else if (raceLocation == "germany") { var targetDate:Date = new Date(currentYear,06,25,12,0,0,0); }
else if (raceLocation == "hungary") { var targetDate:Date = new Date(currentYear,07,01,12,0,0,0); }
else if (raceLocation == "belgium") { var targetDate:Date = new Date(currentYear,07,29,12,0,0,0); }
else if (raceLocation == "italy") { var targetDate:Date = new Date(currentYear,08,12,12,0,0,0); }
else if (raceLocation == "singapore") { var targetDate:Date = new Date(currentYear,08,26,12,0,0,0); }
else if (raceLocation == "japan") { var targetDate:Date = new Date(currentYear,09,10,06,0,0,0); }
else if (raceLocation == "korea") { var targetDate:Date = new Date(currentYear,09,24,06,0,0,0); }
else if (raceLocation == "brazil") { var targetDate:Date = new Date(currentYear,10,7,16,0,0,0); }
else if (raceLocation == "abudhabi") { var targetDate:Date = new Date(currentYear,10,14,13,0,0,0); }
else { var targetDate:Date = new Date(currentYear,0,1,1,0,0,0); }
When I run this I see this Output error:
**Error** Scene=Scene 1, layer=Actions, frame=1:Line 32: ')' or ',' expected
else if (raceLocation == "italy") { var targetDate:Date = new Date(currentYear,08,12,12,0,0,0); }
**Error** Scene=Scene 1, layer=Actions, frame=1:Line 33: 'else' encountered without matching 'if'
else if (raceLocation == "singapore") { var targetDate:Date = new Date(currentYear,08,26,12,0,0,0); }
I've checked the code a dozen times and I'm sure it's right. Am I going mad or have I overlooked something really simpe?
Thanks,
Dave