I’m trying to figure out how to integrate an if/then statement with the “getDay” function.
I want Flash to find out what the date is. I know I can do this with:
var dayOfWeek_array:Array = new Array("Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday");
var today_date:Date = new Date();
var day_str:String = dayOfWeek_array[today_date.getDay()];
trace("Today is "+day_str);
That’ll get me today’s date.
How do I take that output, string, whatever and make an if/then statement to tell it what movie to load?
This doesn’t work, but here’s what I have:
if (day_str == 1) {
loadMovieNum("promo.swf", this.fb_1);
}
if (day_str == 2) {
loadMovieNum("promo.swf", this.fb_1);
}
if (day_str == 3) {
loadMovieNum("wed.swf", this.fb_1);
} else {
this.fb_1.loadMovie("promo.swf");
}
if (day_str == 4) {
loadMovieNum("thur.swf", this.fb_1);
} else {
this.fb_1.loadMovie("promo.swf");
}
if (day_str == 5) {
loadMovieNum("fri.swf", this.fb_1);
} else {
this.fb_1.loadMovie("promo.swf");
}
if (day_str == 6) {
loadMovieNum("sat.swf", this.fb_1);
} else {
this.fb_1.loadMovie("promo.swf");
}
if (day_str == 7) {
loadMovieNum("promo.swf", this.fb_1);
}
How do I get these two to talk to each other, first finding the day value and then loading the correct movie based on that value?
A brief explanation on how you figured it out would be good to. I’m really trying to learn AS.
Thanks.