DETECTING THE PROCESSOR SPEED ON THE POCKET PC WITH FLASH


There will be times when a user is accessing your content from a variety of Pocket PCs as well as desktop systems. In addition to processor detection, it is also possible to detect the processor speed of the Pocket PC using ActionScript. This can be useful for giving your applications a longer "shelf life." For example, if a new Pocket PC is released with a 400MHz ARM processor next year, you may want to load additional content that can take advantage of the faster processor.

To detect the processor speed of a Pocket PC, place the following script in the first frame of the Flash application on the Pocket PC:

 n = 0;  a = getTimer();  while (Number(n)<1000) {   n = Number(n)+1;  }  b = getTimer();  CPUlag = b-a;  if (Number(CPUlag)>100) {   response = "you're on a device";  } else {   response = "you're on a desktop";  }  counter++;  In the second frame, loop back to the first frame by adding the following action:  if(counter < 24)  {           gotoAndPlay (1);  }  else  {           stop();  } 

On the stage, create a variable text field and call the text field CPUlag (see Figure 2.34).

Figure 2.34. Variable text field with CPUlag as the variable.

graphics/02fig34.gif

When testing the movie on the desktop, you can expect a return of 10 80 milliseconds. Pocket PC 2002 devices, which are all based on 206MHz ARM processors, should give a result around 225 275 milliseconds. Figure 2.35 shows the result given after the CPU speed has been successfully detected.

Figure 2.35. Successful CPU speed detection on the Pocket PC with Flash.

graphics/02fig35.gif



Macromedia Flash Enabled. Flash Design and Development for Devices
Macromedia Flash Enabled. Flash Design and Development for Devices
ISBN: 735711771
EAN: N/A
Year: 2002
Pages: 178

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net