Get day()

I am trying to get a flash movie to do different things when it is a certain day.
An example of this is that if it is thursday then the movie will goto frame 6 and stop, then when the day changes to friday it will goto fram 7 and stop.

Does anyone know how I go about doing this?

This is the actionscript that I have come up with so far(which doesn’t work).

stop();
now = getDay();
if (now=0) {
gotoAndStop(2);
} else if (now=1) {
gotoAndStop(3);
} else if (now=2) {
gotoAndStop(4);
} else if (now>=3) {
gotoAndStop(5);
} else if (now=4) {
gotoAndStop(6);
} else if (now=5) {
gotoAndStop(7);
} else if (now=6) {
gotoAndStop(8);
}

Is there anything that I can do to this actionscript that would make it work?

Thanks.

now = getDay();

Although I don’t know about a getDay() function, the one fault I can see is it should be

now == getDay();

Because before you were not setting the variable, just asking for it’s value.

Hope it’s helped,
ignusb

thanks for replying.

It still doesnt work properly though and I am still confused as to why. =)

Two things

[color=Red]1)
[/color]= is to asign a value to a variable
== is to test two variable/values

[color=Green]2)
[/color]getDay(); is not a global function. It belongs to the Date class. So to use it you have to make a new Date object. You can use the Date object to call the get day function.


 stop();
 [color=Green]myDate = new Date();[/color]
 now = [color=Green]myDate.getDay();[/color]
 if (now [color=Red]==[/color] 0) {
     gotoAndStop(2);
 } else if (now [color=Red]==[/color] 1) {
     gotoAndStop(3);
 } else if (now [color=Red]==[/color] 2) {
     gotoAndStop(4);
 } else if (now [color=Red]==[/color] 3) {
     gotoAndStop(5);
 } else if (now [color=Red]==[/color] 4) {
     gotoAndStop(6);
 } else if (now [color=Red]==[/color] 5) {
     gotoAndStop(7);
 } else if (now [color=Red]==[/color] 6) {
     gotoAndStop(8);
 }
 

=)

oops, i’ve been learning C++ lately, and im getting that and AS confused, sorry, i’m gonna have to be more careful with that…

Thanks for that,it now works fine,although I now have another problem with it.

The actionscript works fine in Flash but when I publish it(I want it on my desktop as a background) it doesn’t work.
It stays at the first frame which has the actionscript in it.
The swf file also does not work.

Do you know why this happens and how I can sort it out?

Thanks again.

Background flash… I assume your using windows, I have the same problem that I can’t work out how to get it working, I would also be interested in a solution for this problem