Groups | Blog | Home
all groups > flash actionscript > may 2004 >

flash actionscript : processor speed



Ally
5/31/2004 7:12:54 PM
Is there any way to tell the processor speed of the machine that a Flash
movie is running on? I have a processor intensive Flash file (to be run off
a CD ROM) and I want to give the user the ability to select between this
version and a less intense version. I would like to give them a hint as to
which one to select in case they have no idea is their machine is fast
enough.

Using MX2004.

Thanks for any help.

kglad
6/1/2004 5:53:03 AM
there's no direct way to determine cpu speed. however, you can run a cpu
intensive flash loop and see when the processor starts to slow. that will let
you judge a user's cpu capacity. taking some code from another thread today
you can use the code below. it draws lines on the screen. my 64-bit amd 3400
starts to slow between the 500th and 600th line:


_root.createEmptyMovieClip("mc1", 1);
with (mc1) {
this.diffA = new Array();
this.cnt = -1;
this.ccnt = -1;
this.test = 0;
lineStyle(1, 0xFF0000, 100);
moveTo(0, 0);
onEnterFrame = function () {
this.cnt++;
if (this.test) { // every hundred iterations a test is run to see if the
time required to add a new line has slowed from the start of this process
this.test = 0;
this.diffA[this.ccnt] = getTimer()-this.startTime;
trace(this.diffA[this.ccnt]);
if (this.diffA[this.ccnt]>this.diffA[0]+10) {
delete this.onEnterFrame;
trace("done "+this.ccnt); // this is where you can determine which
version of your movie to play.
}
}
lineTo(500*Math.random(), 500*Math.random());
if (this.cnt == Math.round(this.cnt/100)*100) {
this.ccnt++;
this.startTime = getTimer();
this.test = 1;
}
};
}

MyFlashMXIN
6/1/2004 6:31:13 PM
Wow, this is a very good idea!
Ally
6/1/2004 7:06:55 PM
thanks I will give this a try.


[quoted text, click to view]

kglad
6/2/2004 4:30:50 AM
AddThis Social Bookmark Button