Load different content based on the dimensions of a cellphone screen and a typical desktop computer display : System.Capabilities : Development Flash / Flex / ActionScript examples


Flash / Flex / ActionScript examples » Development » System.Capabilities »

 

Load different content based on the dimensions of a cellphone screen and a typical desktop computer display


 

package{
  import flash.display.Sprite;
  import flash.system.Capabilities;
  import flash.net.*;
  public class Main extends Sprite{
    public function Main(){
        var resX:int = flash.system.Capabilities.screenResolutionX;
        var resY:int = flash.system.Capabilities.screenResolutionY;
        
        if ( (resX <= 240&& (resY <= 320) ) {
          var url:String = "main_pocketPC.swf";
        }else {
          var url:String = "main_desktop.swf";
        }
        trace(new URLRequest(url));
    }
  }
}

        



Leave a Comment / Note


 
Verification is used to prevent unwanted posts (spam). .


Flash / Flex / ActionScript examples

 Navioo Development
» System.Capabilities