1  /**
     2   * com.sekati.external.JsBase
     3   * @version 1.0.0
     4   * @author jason m horwitz | sekati.com
     5   * Copyright (C) 2007  jason m horwitz, Sekat LLC. All Rights Reserved.
     6   * Released under the MIT License: http://www.opensource.org/licenses/mit-license.php
     7   */
     8   
     9  /**
    10   * Javascript Utilities
    11   */
    12  class com.sekati.external.JsBase {
    13  
    14  	/**
    15  	 * javascript resize window
    16  	 */
    17  	public static function resizeWindow(w:Number, h:Number):Void {
    18  		getURL( "javascript:top.resizeTo(" + w + "," + h + ")" );
    19  	}
    20  
    21  	/**
    22  	 * javascript shake window
    23  	 */
    24  	public static function shakeWindow(amount:Number):Void {
    25  		getURL( "javascript:function shakewin(n){if(parent.moveBy){for(i = 10;i > 0;i--){for(j = n;j > 0;j--){parent.moveBy(0,i);parent.moveBy(i,0);parent.moveBy(0,-i);parent.moveBy(-i,0);}}}};shakewin(" + amount + ");void(0)" );
    26  	}
    27  
    28  	/**
    29  	 * javascript change status message
    30  	 */
    31  	public static function status(msg:String):Void {
    32  		getURL( "javascript:if(typeof(this.href) != 'undefined') window.status = '" + msg + "' + ' URL: ' + this.href;else return false;void(0)" );
    33  	}
    34  
    35  	/**
    36  	 * javascript pop centered window
    37  	 */
    38  	public static function centerPop(wURL:String, wName:String, w:Number, h:Number, scr:Boolean):Void {
    39  		var cx:Number = Math.round( (System.capabilities.screenResolutionX / 2) - (w / 2) );
    40  		var cy:Number = Math.round( (System.capabilities.screenResolutionY / 2) - (h / 2) );
    41  		getURL( "javascript:NewWindow=window.open('" + wURL + "','" + wName + "','width=" + w + ",height=" + h + ",left=" + cx + ",top=" + cy + ",screenX=" + cx + ",screenY=" + cy + ",toolbar=no,location=no,scrolling=" + scr + ",directories=no,scrollbars=" + scr + ",status=no,statusbar=no,resizable=no,fullscreen=no'); NewWindow.focus(); void(0);" );
    42  	}
    43  
    44  	private function JsBase() {
    45  	}	
    46  }