PDA

View Full Version : Numbers, Strings, and the Date



Phlashman
November 11th, 2004, 07:24 PM
Sorry for the really simple question, but I forgot something. Let's say I'm trying to display the date. For the minutes thing, I have:

minutes = my_date.getMinutes()

First, I think I need to convert that second thing into a string.
Second, do I need to introduce my date variable earlier? That's kind of weird.
Thanks.

By the way, I believe that this AS shows up as undefined. (not NaN, whatever that is).

claudio
November 11th, 2004, 07:26 PM
You have to define my_date first as a Date object

my_date = new Date();
minutes = my_date.getMinutes();

Phlashman
November 11th, 2004, 07:29 PM
Thanks so much! Now, I have another simple problem. I have this in my first and only frame of my movie, so it should loop, right. My seconds aren't updating.

claudio
November 11th, 2004, 07:34 PM
Combine it with an onEnterFrame event:
onEnterFrame = function () {
minutes = my_date.getMinutes();
trace(minutes);
};

Phlashman
November 11th, 2004, 07:36 PM
Thanks, claudio! I never thought that matter unless it was on an mc.

claudio
November 11th, 2004, 07:40 PM
Anytime Phlashman :)