• Home
  • Free Tutorials
  • Free Video Tutorials

Adobe Photoshop
Autodesk 3ds Max
CSS
Flash
Help Center Live
iPhone
Joomla
Make Money Online!
Mambo
mIRC
Outlook Express
SEO / SEM
Simple Machine Forum
Target Explorer

User Resolution Detection

Category : Flash Views : 12880
Version : 8 Rating : 
2.9/5 (33 votes)
  • Currently 2.91/5
  • 1
  • 2
  • 3
  • 4
  • 5
Type : Text Source File: user-resolution-detection.zip
Result: See the result


Sometimes you may have a movie that requires a certain resolution to play, using this code you will be able to tell whether the user is using the resolution you want and then run the code.

You won't be able to change the resolutions as they are ready only, but knowing the resolution is really good.

Paste this code on the main timeline:
//stop the frames. stop(); var res = System.capabilities.screenResolutionX + " x " + System.capabilities.screenResolutionY var resX:Number = System.capabilities.screenResolutionX; _root.gotoAndStop("res" + resX);

This set the variable "res" to the resolution:
var res = System.capabilities.screenResolutionX + " x " + System.capabilities.screenResolutionY

System.capabilities.screenResolutionX is the width of the screen resolution; it can be 800, 1024, 1152, etc.
System.capabilities.screenResolutionY is the height; it can be 600, 768, 720, etc.
So if your resolution is 800x600, "res" will be "800x600".

Create the "resX" to hold the X resolution:
var resX:Number = System.capabilities.screenResolutionX;
You can notice here that it returns a number, not a string; Pay attention to that when using this property.

And here we go to a frame based on the screen resolution:
_root.gotoAndStop("res" + resX);

For this to work your frames need to be named like this: "res800", "res1024", "res1152", etc.

You can also use the "switch" statement to select which part of the code to run.

Here is an example:
switch (resX) { //if 800x600 case 800: //run code 1 //leave switch statement break; //if 1024x768 case 1024: //run code 2 break; //if 1152x864 case 1152: //run code 3 break; //if none of the above. default: //run code 4 break; }


More cool tech articles from other blogs.

Place your ad here
Loading...

How to Video Tutorials on software by Helpvids.com

Sponsors





Interactive World Map
Drupal E-commerce
Studio | Advertisement | About Webzo | Contact Webzo | Terms of Use | Free Video Tutorials by Helpivds

Copyright © 2007 NR Concepts Ltd. All rights reserved.