1277 posts
  • Has been part of the Envato Community for over 7 years
  • Has referred 100+ members
  • Has sold $40,000+ on Envato Market
  • Interviewed on an Envato blog
+7 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

8088 posts
  • Has been part of the Envato Community for over 5 years
  • Has sold $40,000+ on Envato Market
  • Sells items exclusively on Envato Market
  • Has referred 10+ members
+4 more
doru says
1277 posts
  • Has been part of the Envato Community for over 7 years
  • Has referred 100+ members
  • Has sold $40,000+ on Envato Market
  • Interviewed on an Envato blog
+7 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
  • Has been part of the Envato Community for over 7 years
  • Has referred 200+ members
  • Had an item featured in an Envato Bundle
  • Has collected 10+ items on Envato Market
+2 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

8088 posts
  • Has been part of the Envato Community for over 5 years
  • Has sold $40,000+ on Envato Market
  • Sells items exclusively on Envato Market
  • Has referred 10+ members
+4 more
doru says

360 / 60 = 6 degree per second

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

1277 posts
  • Has been part of the Envato Community for over 7 years
  • Has referred 100+ members
  • Has sold $40,000+ on Envato Market
  • Interviewed on an Envato blog
+7 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

8088 posts
  • Has been part of the Envato Community for over 5 years
  • Has sold $40,000+ on Envato Market
  • Sells items exclusively on Envato Market
  • Has referred 10+ members
+4 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) :)

2485 posts Premium Scripts, Plugins and Themes
  • Has been part of the Envato Community for over 7 years
  • Has referred 200+ members
  • Has sold $125,000+ on Envato Market
  • Has been a beta tester for an Envato feature
+6 more
LucidStudios says

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

1277 posts
  • Has been part of the Envato Community for over 7 years
  • Has referred 100+ members
  • Has sold $40,000+ on Envato Market
  • Interviewed on an Envato blog
+7 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)

6138 posts
  • Sells items exclusively on Envato Market
  • Elite Author: Sold more than $75,000 on Envato Market
  • Has sold $125,000+ on Envato Market
  • Has been part of the Envato Community for over 6 years
+8 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)

Helpful Information

  • Please read our community guidelines. Self promotion and discussion of piracy is not allowed.
  • Open a support ticket if you would like specific help with your account, deposits or purchases.
  • Item Support by authors is optional and may vary. Please see the Support tab on each item page.

Most of all, enjoy your time here. Thank you for being a valued Envato community member.

Post Reply

Format your entry with some basic HTML. Read the Full Details, or here is a refresher:

<strong></strong> to make things bold
<em></em> to emphasize
<ul><li> or <ol><li> to make lists
<h3> or <h4> to make headings
<pre></pre> for code blocks
<code></code> for a few words of code
<a></a> for links
<img> to paste in an image (it'll need to be hosted somewhere else though)
<blockquote></blockquote> to quote somebody

:grin: :shocked: :cry: Complete List of Smiley Codes

by
by
by
by
by
by