Skip to main content
Participant
November 6, 2008
Question

Actionscript to Stop Clock

  • November 6, 2008
  • 2 replies
  • 356 views
I have created a Clock in flash using the following actionscript:
time=new Date(); // time object
seconds = time.getSeconds()
minutes = time.getMinutes()
hours = time.getHours()

hours = hours + (minutes/60);

seconds = seconds*6;
minutes = minutes*6;
hours = hours*30;

sec._rotation=seconds;
min._rotation=minutes;
hour._rotation=hours;

What I need help with is I want the clock to stop when the time reaches 11h 11min and 11sec.
What code would I need to use?

Any help would be appreciated.
This topic has been closed for replies.

2 replies

Inspiring
November 10, 2008
Use "clbeech" Code in your onEnterFrame function
clbeech
Inspiring
November 6, 2008
you can use a conditional statement to check the time(s) wherever you are running the loop that updates the positions add something like this:
Participant
November 10, 2008
Ok, i used another online tutorial to create an antique style clock but I am still having difficulty using code to make it stop. Is there code I can use to specify the time I want the Movie to stop playing or is there code I can use so by pressing a hotkey it will stop the Movie?
Here is the code I am using:
clock.onEnterFrame = function():Void {
var clockTime:Date = new Date();
var seconds:Number = clockTime.getSeconds();
var minutes:Number = clockTime.getMinutes();
var hours:Number = clockTime.getHours();
this.secondHand._rotation = seconds*6;
this.minuteHand._rotation = minutes*6;
this.hourHand._rotation = (hours*30)+(minutes/2);
}