View Full Version : Help with An Answer To A Simple Question!
FirebirdWorks
10-26-2007, 01:08 AM
I need to make a script to count as fast as possible to a number.
For reference, that number is 6022000000. Can anyone help me, I have tried for things such as a++, but it doesn't seem to work so hot...
Thanks in advance.
You need to give a little more information about what you're trying to do.
Is this something visual you need to happen, like the number in a textField incrementing?
What event are you using to increment the number now? (onEnterFrame?)
You could use an interval which can fire much faster then an onEnter (within reasonable FPS settings), or you could increment by more then one, etc..
For example, this increments a number by one as many times per second as you have your FPS set:
var a:Number = 1
this.onEnterFrame=function(){
a++
}
You can also increment that by a larger number. This would increment by 5 on each enterFrame:
var a:Number = 1
this.onEnterFrame=function(){
a+=5
}
You could also use an interval as I mentioned which can be set to as small as 1ms. You could even use a for loop if you wanted to which I believe would be the fastest Flash can run, but it would be faster then the eye could see, so it probably isn't what you're looking for...
Like, this would appear to happen almost instantly (depending on the computer):
for (a=1; a<6000; a++) {
trace(a);
}
|
vBulletin® v3.8.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.