1  	/**
     2   * com.sekati.display.LiquidClip
     3   * @version 1.0.9
     4   * @author jason m horwitz | sekati.com | tendercreative.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   import com.sekati.display.ILiquidClip;
    10   import com.sekati.display.UIClip;
    11   import com.sekati.display.StageDisplay;
    12   import com.sekati.events.Dispatcher;
    13   import com.sekati.utils.Delegate;
    14  
    15  /**
    16   * LiquidClip - mixin for any subclass which needs to respond to {@link com.sekati.display.StageDisplay} 
    17   * events such as onResize, onResizeComplete or onFullScreen. 
    18   * Note: Extends {@link com.sekati.display.UIClip} to allow for easy/automatic TextField CSS styling.
    19   */
    20  class com.sekati.display.LiquidClip extends UIClip implements ILiquidClip {
    21  
    22  	/**
    23  	 * Constructor
    24  	 */
    25  	public function LiquidClip() {
    26  		super();
    27  		Dispatcher.$.addEventListener(StageDisplay.onStageResizeEVENT, Delegate.create (_this, _onResize));
    28  		Dispatcher.$.addEventListener(StageDisplay.onStageResizeCompleteEVENT, Delegate.create (_this, _onResizeComplete));
    29  		Dispatcher.$.addEventListener(StageDisplay.onStageFullScreenEVENT, Delegate.create (_this, _onFullScreen));
    30  		_onResize();
    31  		_onResizeComplete();
    32  	}
    33  
    34  	/**
    35  	 * Clip has been loaded and registered on Stage.
    36  	 * @return Void
    37  	 */
    38  	public function configUI():Void {
    39  		super.configUI();
    40  		_onResize();
    41  		_onResizeComplete();
    42  	}
    43  	
    44  	/**
    45  	 * Application has been Configured (Config & Data loaded).
    46  	 * NOTE: Automatically applies the application stylesheet to all TextField Objects!
    47  	 * @return Void
    48  	 */
    49  	public function onAppConfigured():Void {
    50  		super.onAppConfigured();
    51  		_onResize();
    52  		_onResizeComplete();		
    53  	}
    54  	
    55  	/**
    56  	 * _onFullscreen stub: fires when Stage resize has occurs.
    57  	 * @return Void
    58  	 */
    59  	public function _onResize():Void {
    60  		//App.log.info(_this, StageDisplay.onStageFullScreenEVENT+" Fired!");
    61  	}
    62  	
    63  	/**
    64  	 * _onResizeComplete stub: fires {@link com.sekati.display.StageDisplay._resizeDelayMs} milliseconds after a Stage resize has occured.
    65  	 * @return Void
    66  	 */	
    67  	public function _onResizeComplete():Void {
    68  		//App.log.info(_this, StageDisplay.onStageResizeCompleteEVENT+" Fired!");
    69  	}
    70  	
    71  	public function _onFullScreen():Void {
    72  		_onResize();
    73  		//App.log.info(_this, StageDisplay.onStageResizeCompleteEVENT+" Fired!");
    74  	}
    75  	
    76  	/**
    77  	 * Remove Dispatcher listeners onUnload.
    78  	 * @return Void
    79  	 */
    80  	public function onUnload():Void {
    81  		Dispatcher.$.removeEventListener(StageDisplay.onStageResizeEVENT, _this);	
    82  		Dispatcher.$.removeEventListener(StageDisplay.onStageResizeCompleteEVENT, _this);
    83  		Dispatcher.$.removeEventListener(StageDisplay.onStageFullScreenEVENT, _this);
    84  		super.onUnload();
    85  	}	
    86  	
    87  }