Set interval for milliseconds not working
hello. when increment counter every millisecond setinterval, slow.
here code:
var second:number = 0; var millisecond:number = 0; function updatemil(){ millisecond ++; } setinterval(updatemil,1); function updatesec(){ second++; trace(millisecond+", "+second); } setinterval(updatesec,1000);
and outputs:
133, 1
255, 2
387, 3
515, 4
647, 5
779, 6
where seconds on right updates every second correctly. surely milliseconds on left should in 1000 increments because 1000 milliseconds make second.
the fastest setinterval can loop is, on average, 1000/frame_rate ms frame_rate swf's frame rate.
More discussions in ActionScript 1 and 2
adobe
Comments
Post a Comment