1281 posts
  • 7 Years of Membership
  • Affiliate Level 4
  • Author Level 6
  • Blog Interview
+8 more
rondog
says

I have a timer that turns a hand on a clock

Now the hand has to go the full 360 degrees which would be the start to finish.

How can I adjust the timer delay based off a number, say like 15 seconds?

This is as3..thanks guys

8176 posts
  • Author Level 6
  • Trendsetter
  • Weekly Top Seller
  • Community Superstar
+8 more
doru
says
1281 posts
  • 7 Years of Membership
  • Affiliate Level 4
  • Author Level 6
  • Blog Interview
+8 more
rondog
says

I know how to use the delay lol

I need to know how much of a delay to set

So say I need to move 360 degrees over 15 seconds. I need to figure out that delay. Say I need to move 360 degrees over 30 seconds.. I need to figure out that delay. I just don’t know the formula to get that delay.

341 posts
  • 7 Years of Membership
  • Affiliate Level 5
  • Bundle Boss
  • Collector Level 2
+4 more
OXYLUS
says

Make the delay 15000 / 360 and in the time handler, increment the rotation with 1. If you want to increment it by n, make the delay 15000 / (360 / n). You get the idea

8176 posts
  • Author Level 6
  • Trendsetter
  • Weekly Top Seller
  • Community Superstar
+8 more
doru
says

360 / 60 = 6 degree per second

360 degrees / time = how many degree to move per second

1281 posts
  • 7 Years of Membership
  • Affiliate Level 4
  • Author Level 6
  • Blog Interview
+8 more
rondog
says

Well it seems the higher my seconds are the more inaccurate it is. If I set it to 5 seconds, it seems pretty accurate. Setting it to 15 takes about 24 seconds to make that 360 degree rotation. Here is my class. Just open a new FLA and:

import StopWatch;
var sw:StopWatch = new StopWatch(15);
addChild(sw);

then click the stage to start the timer.

StopWatch.as: http://pastie.org/1376761

8176 posts
  • Author Level 6
  • Trendsetter
  • Weekly Top Seller
  • Community Superstar
+8 more
doru
says

you should search for accurate timer in as3, it is used mostly in games but you can apply it to your project. I had some links around, if you don’t find it on the net I would try to find those links (that I don’t know were they are now) :)

2486 posts Premium Scripts, Plugins and Themes
  • 8 Years of Membership
  • Affiliate Level 5
  • Author Level 8
  • Beta Tester
+9 more
LucidStudios
says

15*24 = 360, so what’s wrong?

1281 posts
  • 7 Years of Membership
  • Affiliate Level 4
  • Author Level 6
  • Blog Interview
+8 more
rondog
says

15*24 = 360, so what’s wrong?

I want it to take 15 seconds to make the 360 degree rotation..its taking 24 seconds

Check this out: http://ronnieswietek.com/_random/timer.swf

The watch on the left is set to 15 seconds and the watch on the right is set to 5 seconds (click the stage to start)

6231 posts
  • Exclusive Author
  • Elite Author
  • Author Level 8
  • 7 Years of Membership
+13 more
VF
says

Looks like the problem is due to frame rate and timer trigger having a slip. Instead of time based triggering, try with enterframe. (ie, on each enterframe get the time lapse, find angle and rotate accordingly)

by
by
by
by
by
by