Use the screen resolution values to center a pop-up browser window : System.Capabilities : Development Flash / Flex / ActionScript examples


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

 

Use the screen resolution values to center a pop-up browser window


 

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;
        
        var winW:int 200;
        var winH:int 200;
        
        var winX:int (resX / 2(winW / 2);
        var winY:int (resY / 2(winH / 2);
        
        var jsCode:String = "javascript:void(newWin=window.open('http://www.navioo.com/'," 
                 "'newWindow', 'width=" + winW +
                 ", height=" +  winH + "," 
                 "left=" + winX + ",top=" + winY + "'));";
        
    }
  }
}

        



Leave a Comment / Note


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


Flash / Flex / ActionScript examples

 Navioo Development
» System.Capabilities