chrisopia
05-16-2006, 02:42 PM
It's me, I'm back... heeey!!
Can someone tell me what is wrong with this code?
var myDate:Date = new Date();
var myMonth = myDate.getMonth();
var myDay = myDate.getDay();
if (myMonth == 0 ) {
tree_mc.gotoAndStop("Winter");
}
if (myMonth == 1 ) {
tree_mc.gotoAndStop("Winter");
}
if (myMonth == 2 ) {
tree_mc.gotoAndStop("Winter");
}
if ((myMonth == 2 )&&(myDay >= 21)){
tree_mc.gotoAndStop("Spring");
}
if (myMonth == 3 ) {
tree_mc.gotoAndStop("Spring");
}
if (myMonth == 4 ) {
tree_mc.gotoAndStop("Spring");
}
if ((myMonth == 5 )) {
tree_mc.gotoAndStop("Spring");
}
if ((myMonth == 5 ) && (myDay >= 21)) {
tree_mc.gotoAndStop("Summer");
}
if (myMonth == 6 ) {
tree_mc.gotoAndStop("Summer");
}
if (myMonth == 7 ) {
tree_mc.gotoAndStop("Summer");
}
if (myMonth == 8 ) {
tree_mc.gotoAndStop("Summer");
}
if ((myMonth == 8 ) && (myDay >= 21)) {
tree_mc.gotoAndStop("Autumn");
}
if (myMonth == 9 ) {
tree_mc.gotoAndStop("Autumn");
}
if (myMonth == 10 ) {
tree_mc.gotoAndStop("Autumn");
}
if (myMonth == 11 ) {
tree_mc.gotoAndStop("Autumn");
}
if ((myMonth == 11 ) && (myDay >= 21)){
tree_mc.gotoAndStop("Winter");
}
At first glance, it looks pretty fine... which is it... the tree changes form as it should... but not when it should!?
The tree should change to
Spring on March 21,
Summer on June 21st
Autumn (fall) on September 21st
Winter on December 21st!
But it doesn't!?
Instead it just stays the same? Like it's forever Winter in March and doesn't change to Spring until April!
Can someone tell me what is wrong with this code?
var myDate:Date = new Date();
var myMonth = myDate.getMonth();
var myDay = myDate.getDay();
if (myMonth == 0 ) {
tree_mc.gotoAndStop("Winter");
}
if (myMonth == 1 ) {
tree_mc.gotoAndStop("Winter");
}
if (myMonth == 2 ) {
tree_mc.gotoAndStop("Winter");
}
if ((myMonth == 2 )&&(myDay >= 21)){
tree_mc.gotoAndStop("Spring");
}
if (myMonth == 3 ) {
tree_mc.gotoAndStop("Spring");
}
if (myMonth == 4 ) {
tree_mc.gotoAndStop("Spring");
}
if ((myMonth == 5 )) {
tree_mc.gotoAndStop("Spring");
}
if ((myMonth == 5 ) && (myDay >= 21)) {
tree_mc.gotoAndStop("Summer");
}
if (myMonth == 6 ) {
tree_mc.gotoAndStop("Summer");
}
if (myMonth == 7 ) {
tree_mc.gotoAndStop("Summer");
}
if (myMonth == 8 ) {
tree_mc.gotoAndStop("Summer");
}
if ((myMonth == 8 ) && (myDay >= 21)) {
tree_mc.gotoAndStop("Autumn");
}
if (myMonth == 9 ) {
tree_mc.gotoAndStop("Autumn");
}
if (myMonth == 10 ) {
tree_mc.gotoAndStop("Autumn");
}
if (myMonth == 11 ) {
tree_mc.gotoAndStop("Autumn");
}
if ((myMonth == 11 ) && (myDay >= 21)){
tree_mc.gotoAndStop("Winter");
}
At first glance, it looks pretty fine... which is it... the tree changes form as it should... but not when it should!?
The tree should change to
Spring on March 21,
Summer on June 21st
Autumn (fall) on September 21st
Winter on December 21st!
But it doesn't!?
Instead it just stays the same? Like it's forever Winter in March and doesn't change to Spring until April!