# Get day()

**URL:** <https://forum.kirupa.com/t/get-day/116765>\
**Category:** Uncategorized\
**Created:** [July 21, 2004, 8:01am UTC](https://forum.kirupa.com/t/get-day/116765 "2004-07-21T08:01:06Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![daveeed](https://avatars.discourse-cdn.com/v4/letter/d/ccd318/32.png) [@daveeed](https://forum.kirupa.com/u/daveeed)\
**Post date:** [July 21, 2004, 8:01am UTC](https://forum.kirupa.com/t/get-day/116765/1 "2004-07-21T08:01:06Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 21, 2004, 8:40am UTC](https://forum.kirupa.com/t/get-day/116765/2 "2004-07-21T08:40:00Z")

</div>

```auto
now = getDay();

```

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

```auto
now == getDay();

```

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

Hope it’s helped,  
ignusb

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 21, 2004, 8:50am UTC](https://forum.kirupa.com/t/get-day/116765/3 "2004-07-21T08:50:06Z")

</div>

thanks for replying.

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

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 21, 2004, 9:32am UTC](https://forum.kirupa.com/t/get-day/116765/4 "2004-07-21T09:32:22Z")

</div>

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.

```auto

 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);
 }
 

```

=)

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 21, 2004, 10:27am UTC](https://forum.kirupa.com/t/get-day/116765/5 "2004-07-21T10:27:49Z")

</div>

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…

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 22, 2004, 11:12am UTC](https://forum.kirupa.com/t/get-day/116765/6 "2004-07-22T11:12:39Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 22, 2004, 7:54pm UTC](https://forum.kirupa.com/t/get-day/116765/7 "2004-07-22T19:54:26Z")

</div>

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
