- Author was Featured
- Bought between 50 and 99 items
- Contributed a Tutorial to a Tuts+ Site
- Exclusive Author
- Has been a member for 5-6 years
- Interviewed on the Envato Notes blog
- Item was Featured
- Referred between 100 and 199 users
- Repeatedly Helped protect Envato Marketplaces against copyright violations
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
- Community Superstar
- Italy
- Sold between 10 000 and 50 000 dollars
- Has been a member for 3-4 years
- Microlancer Beta Tester
- Beta Tester
- Repeatedly Helped protect Envato Marketplaces against copyright violations
- Exclusive Author
- Author had a Free File of the Month
using the delay property?
http://www.adobe.com/livedocs/flash/9.0/ActionScriptLangRefV3/flash/utils/Timer.html#delay
- Author was Featured
- Bought between 50 and 99 items
- Contributed a Tutorial to a Tuts+ Site
- Exclusive Author
- Has been a member for 5-6 years
- Interviewed on the Envato Notes blog
- Item was Featured
- Referred between 100 and 199 users
- Repeatedly Helped protect Envato Marketplaces against copyright violations
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.
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
- Community Superstar
- Italy
- Sold between 10 000 and 50 000 dollars
- Has been a member for 3-4 years
- Microlancer Beta Tester
- Beta Tester
- Repeatedly Helped protect Envato Marketplaces against copyright violations
- Exclusive Author
- Author had a Free File of the Month
360 / 60 = 6 degree per second
360 degrees / time = how many degree to move per second
- Author was Featured
- Bought between 50 and 99 items
- Contributed a Tutorial to a Tuts+ Site
- Exclusive Author
- Has been a member for 5-6 years
- Interviewed on the Envato Notes blog
- Item was Featured
- Referred between 100 and 199 users
- Repeatedly Helped protect Envato Marketplaces against copyright violations
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
- Community Superstar
- Italy
- Sold between 10 000 and 50 000 dollars
- Has been a member for 3-4 years
- Microlancer Beta Tester
- Beta Tester
- Repeatedly Helped protect Envato Marketplaces against copyright violations
- Exclusive Author
- Author had a Free File of the Month
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) 
- Author was Featured
- Bought between 10 and 49 items
- Exclusive Author
- Has been a member for 6-7 years
- Interviewed on the Envato Notes blog
- Item was Featured
- Microlancer Beta Tester
- Referred between 200 and 499 users
15*24 = 360, so what’s wrong?
- Author was Featured
- Bought between 50 and 99 items
- Contributed a Tutorial to a Tuts+ Site
- Exclusive Author
- Has been a member for 5-6 years
- Interviewed on the Envato Notes blog
- Item was Featured
- Referred between 100 and 199 users
- Repeatedly Helped protect Envato Marketplaces against copyright violations
LucidStudios said
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)
- Exclusive Author
- Item was Featured
- Author was Featured
- Author had a File in an Envato Bundle
- Has been a member for 4-5 years
- Sold between 100 000 and 250 000 dollars
- Repeatedly Helped protect Envato Marketplaces against copyright violations
- India
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)
