-
counting numbers from 1 - 29,000 in 7 min...
hello there
please help, need to count numbers faster from num. 1 to 29,000 with duration of 7 min...
many thanks
David
Last edited by davidkhen; 01-23-2007 at 09:54 AM.
-
-
OOP is one letter from OOPS
Faster???
When I ran this:
var startVal:Number = 1;
var endVal:Number = 29000;
var startTime = getTimer();
trace ("Start Time: =" + startTime)
for (i= startVal; i<endVal;i++){
}
var endTime = getTimer()
trace ("Elapsed time = " + (endTime-startTime));
It traced:
Start Time: =23
Elapsed time = 90
Meaning the whole thing took 90 milliseconds.
Could you explain a bit more about what you are doing?
-
FK'n_dog
can you explain what you are trying to do with 29,000 and 7 minutes
what code do you have so far ?
edit : kortex beat me to it
-
thanks ...
i have to make a presentation, with 7 minutes of duration
and i have to include in it a numbers that runs from 1 to 29000 like timer...
??
-
OOP is one letter from OOPS
I think why we are confused is the word faster. It would actually take more code to make sure that this took 7 minutes.
-
FK'n_dog
this is prolly innaccurate but may help
Code:
var mins:Number = 7;
var msec:Number = mins*60000; // 7 mins in milliseconds - 420000
var div:Number = msec/29000; // divisor = 14.4827586206897
var count:Number = 0;
function tracer(){
count++;
trace(count);
trace(getTimer()+"milliseconds");
if(count == 29000) clearInterval(traceInt);
}
traceInt = setInterval(tracer,div);
kortex, do you have a better/ more accurate idea ?
-
OOP is one letter from OOPS
setInterval was the way I was going to go as well
-
first of all thank's...
but i can't make the code to run...
a have uploaded the image of a presentation in my server
please take a look,
http://www.igdm.co.il/david/presentation.gif
the numbers must to run from 1 up to 29000
and years from 1957 up to 2007
the duration of this must to be at lest 7 minute ...
thanks again
david
-
OOP is one letter from OOPS
Example FLA
Here is some sample code: See attached FLA as an example:
Code:
var nmbr:Number = 1;
var yrInterval:Number = Math.floor((7*60*1000)/29000);
trace ("Year interval = "+ yrInterval);
var yrs:Array = new Array();
var yrsStart:Date = new Date();
var yrsEnd:Date = new Date();
yrsStart.setYear(1957);
yrsEnd.setYear(2007);
trace(yrsStart.getFullYear()+" "+yrsEnd.getFullYear());
for (i=yrsStart.getFullYear(); i<=yrsEnd.getFullYear(); i++) {
yrs.push(i);
}
//trace (yrs);
var nmbrInterval:Number = Math.floor((7*60*1000)/yrs.length)
var yrsIndex:Number = 0;
function updateYrs() {
_root.yrs_txt.text = yrs[yrsIndex].toString();
trace("updating years to "+yrs[yrsIndex].toString()+" years text = "+ _root.yrs_txt.text);
yrsIndex++;
if (yrsIndex == yrs.length) {
clearInterval(setYrs);
}
}
updateYrs();
var setYrs = setInterval(updateYrs, nmbrInterval);
function updateNumber(){
_root.nmbr_txt.text = nmbr;
nmbr++
if (nmbr >= 29000){
clearInterval(setNum);
}
}
var setNum = setInterval(updateNumber, yrInterval)
Last edited by kortex; 09-04-2007 at 03:27 PM.
-
kortex - i really don't know how to thank you ...
it's excelent, and 100% what i needed
just many thanks to you
David
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
|