Flash Date Object doesn't work
- Started
- Last post
- 8 Responses
- CyBrainX
I have this statement on frame 2. Frame 3 just loops back to frame 2:
this.timepiece.minutes.gotoAndSt...
I have the getSeconds() method here just to test for now. This only works the first time the script is executed. It should continually update.
Here is the link: http://www.talesfromthehead.com/…
Any help would be greatly appreciated. Flash is against me and I'm not smart.
- autonoma0
Try adding:
delete myDate
after that.
- CyBrainX0
Goodness, gracious me. Mercy sakes alive. Heavens to Betsy.
That worked! I haven't read that bit of code anywhere. Why do they hide this stuff?
- autonoma0
Remember? I'm the other guy working on an interactive calendar screensaver!
- CyBrainX0
Damn, I was just thinking about that. How are you planning to have people save notes on specific dates? I'm not much of a backend kind of guy. (no gay joke intended)
- unfittoprint0
Advice: frame looping is deprecated. you should either use onEnterFrame action or setInterval [better imo].
and you have to create a new Date Object each loop to retrieve real time seconds...
//1st frame action layer
if (myDate == undefined) {
dateFrame = function () {
myDate = new Date();
timepiece.minut es.gotoAndStop(myDat e.getSeconds()+1);
}
dateLoop = setInterval(dateFrame, 500);
}
- CyBrainX0
Unfit, I originally used on enterFrame but was desperately thinking that it wasn't working because the movie clip was only on one frame. I have it working now with on enterframe. I just didn't know you had to create a new date object, do you thing and then delete it every frame.
- tomkat0
why is frame looping out of date? works fine from time to time for me..
- unfittoprint0
indeed. I prefer setnterval becuase you can control loop's speed and transfer function arguments.
If you want to check evaluated time, you'lll make two Date Objects [the first one unique and the second constantly changing] while evaluating the seconds, hours, minutes between them...