getDate and setProperty

Hi there

I am trying to make an interactive calendar. I would like the day to be highlighted when it opens. The highlight is a movie clip with a number for the instance name.

onClipEvent (data) {
todaysDate = new Date();
if (todaysDate.getDate() == 01) {
setProperty(“this”, _visible, “1”);
} else {
setProperty(“this”, _visible, “0”);
}
}

It’s not working and I’m not sure why. I could easily be going about it ALL wrong. I suspect that it being an onClipEvent is an error. Can’t I just getDate and setProperty?

I have attached the file. Once I understand how this works I can duplicate it for loading the correct month and year.

Any help or direction would be really appreciated.
thanks
ogm

I got It!!!

onClipEvent (load) {
myDate = new Date();
today = myDate.GetDate();
if (today==02) {
setProperty("", _visible, “1”);
} else {
setProperty("", _visible, “0”);
}
}

I put this code on each highlight instance with the correct number for today.

I’ve almost got it…

I don’t know why but, highlights 08 and 09 are behaving badly. They have the same code but with the appropriate:
if (today==08)

It works for all of the others, so I really don’t have a clue.

onClipEvent (load) {
myDate = new Date();
today = myDate.GetDate();
if (today==08) {
setProperty("", _visible, “1”);
} else {
setProperty("", _visible, “0”);
}
}

Any ideas would be great.
Thanks
OGM

Here

Thanks Claudio
I knew that could be a solution to the problem, which is why I gave them the number names in the first place, but I couldn’t figure out how to write it! (the details). Thanks very very much.
OGM

welcome :thumb:
you could also use a loop if you want the button to perform some action (like display some info)

Hi

That is what I want to do and I just did a search for ‘loop’ and I’m not sure what you mean. I understand a loop as in to make something happen over and over again for a certain amount of time. I made the numbers, buttons, so that when clicked a notifier mc with information from a .txt doc. would show. The number buttons would have instance names that include the year. It’s probably the long way to go about it because I’m afraid of variables.

Thanks for your help. I’m going to look into some more.
OGM

I don’t understand. After looking in the dict. it means that if ‘m’ is 1 or ‘less than or equal to’ 31, it won’t show. That’s sensible. The m++ is tricky though…it means that m+1 also =m? That’s what makes it a loop? Becaue the m++ makes it evaluate itself over and over? Isn’t it in conflict with the number you get for ‘today’?

(var m = 1; m<=31; m++) {
this[m]._visible = false;
this[today]._visible = true;
}

OGM

i++ increments the value of i by 1.
About the conflict you get on today: [AS]this[today]._visible = true; //this line will overwrite the previous line[/AS]i.e:
If i have the following code:[AS]myVar = 15;
myVar=30;
trace(myVar);[/AS] The output will be 30.

Ive corrected your file, when the movie loads, it displays the current day message.

Hi there

You are kind to do this. Thank you.

I understand now: m=1 or <=31 and everything in between because it adds 1 until it hits 31. "today’ wins because of the heirarchy.

Thanks again!:beam:
OGM

You’re welcome =)