-
set Interval problem
hey i have this block of code:
setInterval(function () {
angle += 0.045;
_parent.clock.back.arm._rotation = angle;
timer = i;
}, 1);
it moves an arm on a clock very smoothly, works fine in a SWF but runs far too slowly when in a browser, any ideas would help alot. im lost..
cheers
Looking for a young enthusiastic new media developer? Look no further than… www.2dworld.com
-
Make its rotation change 0.25 degree per 5 msec.
I believe 0.25 degree is the unit that Flash handles rotation.
-
no matter what settings i use it always runs too fast in the broswer.. could it be that set intercal uses cpu speed to work and the cpu is under pressure therefore slower?
http://www.2dworld.com/corp/countdownclock.swf
this is the arm moving 6 degrees every second, not ideal bu this way it keeps the time perfectly.. why not so if i use .00 numbers..?
Looking for a young enthusiastic new media developer? Look no further than… www.2dworld.com
-
Oh, that is what you mean by "slow" !
Both setInterval and onEnterFrame are not evoked at precisely accurate interval. A movie with FPS 12 is not going to be played acurately for one frame per 83.3333333333333 msec;
Yes, the interval is partly affected by the working load of CPU.
If you want to make a clock, you get to peek the system clock.
-
so why does it run fine in a swf on its own when in a broswer it runs too slow? does the broswer have to keep up with the timing of the swf?
Looking for a young enthusiastic new media developer? Look no further than… www.2dworld.com
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|