Play effect on particular day

I want to put a twist on Kirupas excellent snow fall tutorial…

Say I design multiple movieclips (snow for Christmas, pumpkins for halloween, fireworks for bonfire night etc) can I use AS to detect the users local date and call the relevant symbol to rain down?

This would also save me having to design and post a different SWF every occasion! I could design for lots of occasions.

Any ideas?

Ads.

Something like this should work

[AS]
var d=new Date(2004,10,31);
var d2=new Date(2004,10,31);
if(d.toString()==d2.toString())
trace(“it’s holloween!”);
[/AS]

Wouldn’t that make every day “holloween”?

Just tried a few variations myself, there must be something we’re missing somewhere along the line I mean its not a hard thing to do when you think about it.

If Halloween (2004, 10, 31) is the same as Todays date then move “MonthClip” to a specific frame. I hate when seemling simple things end up complex!!

me.

Huzzah, here it works :slight_smile:

[AS]
var now = new Date();
var release = new Date(2004, 10, 31);
if (now.getTime() <= release.getTime()) {
trace(“its Halloween!”);
}
[/AS]

edit: I just re-tested it, and it didn’t work :frowning: I’ll keep working on it; this seems so easy, it’s annoying, lol.

Alright, here it is for the last time…this definetley works

[AS]
onClipEvent (load) {
var myDate = new Date();
var myMonth = myDate.getMonth();
var myDay = myDate.getDate();
var myYear = myDate.getFullYear();
if (myDay == 31 && myMonth == 9 && myYear == 2004) {
trace(“it’s Halloween!”);
}
}
[/AS]

:hugegrin:

edit: used virus’ suggestion and edited the code.

it works… but it’s not a good ideea tu put this on an enterFrame event. onClipEvent(load)… should do the trick

If Halloween (2004, 10, 31) is the same as Todays date then move “MonthClip”[color=red](do you mean the one with the snow?)[/color] to a specific frame. I hate when seemling simple things end up complex!!

This is a good solution… Have you implemented it ? We (as in me) wanna to see :smiley:

ah, your’e right, virusescu :slight_smile:

and i would also love to see it in action :slight_smile: