Packageorg.aswing
Classpublic class AsWingUtils

A collection of utility methods for AsWing.



Public Properties
 PropertyDefined by
  BOTTOM : Number = 3
[static] A fast access to AsWingConstants Constant
AsWingUtils
  CENTER : Number = 0
[static] A fast access to ASWingConstants Constant
AsWingUtils
  HORIZONTAL : Number = 0
[static] A fast access to AsWingConstants Constant
AsWingUtils
  LEFT : Number = 2
[static] A fast access to AsWingConstants Constant
AsWingUtils
  RIGHT : Number = 4
[static] A fast access to AsWingConstants Constant
AsWingUtils
  TOP : Number = 1
[static] A fast access to AsWingConstants Constant
AsWingUtils
  VERTICAL : Number = 1
[static] A fast access to AsWingConstants Constant
AsWingUtils
Public Methods
 MethodDefined by
  
applyTextColor(text:TextField, color:ASColor):void
[static]
AsWingUtils
  
applyTextFont(text:TextField, font:ASFont):void
[static]
AsWingUtils
  
applyTextFontAndColor(text:TextField, font:ASFont, color:ASColor):void
[static] Apply the font and color to the textfield.
AsWingUtils
  
applyTextFormat(text:TextField, textFormat:TextFormat):void
[static]
AsWingUtils
  
centerLocate(popup:JPopup):void
[static] Locate the popup at center of the stage.
AsWingUtils
  
computeStringSize(tf:TextFormat, str:String, includeGutters:Boolean = true, textField:TextField = null):IntDimension
[static] Computes the text size of specified textFormat, text, and textfield.
AsWingUtils
  
computeStringSizeWithFont(font:ASFont, str:String, includeGutters:Boolean = true):IntDimension
[static] Computes the text size of specified font, text.
AsWingUtils
  
createLabel(parent:DisplayObjectContainer = null, name:String = null):TextField
[static] Create a disabled TextField at specified parent with specified name.
AsWingUtils
  
createPaneToHold(com:Component, layout:LayoutManager, constraints:Object = null):Container
[static] Creates and return a pane to hold the component with specified layout manager and constraints.
AsWingUtils
  
createShape(parent:DisplayObjectContainer = null, name:String = null):Shape
[static] Create a shape.
AsWingUtils
  
createSprite(parent:DisplayObjectContainer = null, name:String = null):Sprite
[static] Create a sprite at specified parent with specified name.
AsWingUtils
  
getOwnerAncestor(c:Component):DisplayObjectContainer
[static] Returns the first popup ancestor or display object root of c, or null if can't find the ancestor
AsWingUtils
  
getOwnerComponent(dis:DisplayObject):Component
[static] Returns the component owner of specified obj.
AsWingUtils
  
[static] Returns the MCPanel ancestor of c, or null if it is not contained inside a mcpanel yet
AsWingUtils
  
[static] Returns the center position in the stage.
AsWingUtils
  
getStageMousePosition(stage:Stage = null):IntPoint
[static]
AsWingUtils
  
getVisibleMaximizedBounds(dis:DisplayObject = null):IntRectangle
[static] Returns the currently visible maximized bounds in a display object(viewable the stage area).
AsWingUtils
  
isAncestor(ancestor:Component, child:Component):Boolean
[static] Returns whether or not the ancestor is the child's display ancestor.
AsWingUtils
  
isAncestorComponent(ancestor:Component, child:Component):Boolean
[static] Returns whether or not the ancestor is the child's component ancestor.
AsWingUtils
  
isAncestorDisplayObject(ancestor:DisplayObjectContainer, child:DisplayObject):Boolean
[static] Returns whether or not the ancestor is the child's ancestor.
AsWingUtils
  
isDisplayObjectShowing(dis:DisplayObject):Boolean
[static] Returns whethor or not the display object is showing, which means that it is visible and it's ancestors(parent, parent's parent ...) is visible and on stage too.
AsWingUtils
  
layoutCompoundLabel(c:Component, f:ASFont, text:String, icon:Icon, verticalAlignment:int, horizontalAlignment:int, verticalTextPosition:int, horizontalTextPosition:int, viewR:IntRectangle, iconR:IntRectangle, textR:IntRectangle, textIconGap:int):String
[static] Compute and return the location of the icons origin, the location of origin of the text baseline, and a possibly clipped version of the compound labels string.
AsWingUtils
  
layoutText(f:ASFont, text:String, verticalAlignment:Number, horizontalAlignment:Number, viewR:IntRectangle, textR:IntRectangle):String
[static] Compute and return the location of origin of the text baseline, and a possibly clipped version of the text string.
AsWingUtils
  
updateAllComponentUI(stage:Stage = null):void
[static] When call setLookAndFeel it will not change the UIs at created components.
AsWingUtils
  
[static] When call setLookAndFeel it will not change the UIs at created components.
AsWingUtils
  
updateChildrenUI(dis:DisplayObject):void
[static] Asks every component that is not a ui element containsed in the display object to updateUI().
AsWingUtils
  
[static] A simple minded look and feel change: ask each node in the tree to updateUI() -- that is, to initialize its UI property with the current look and feel.
AsWingUtils
  
[static] All component will be registered here.
AsWingUtils
Property detail
BOTTOMproperty
public static var BOTTOM:Number = 3

A fast access to AsWingConstants Constant

See also

CENTERproperty 
public static var CENTER:Number = 0

A fast access to ASWingConstants Constant

See also

org.aswing.ASWingConstants
HORIZONTALproperty 
public static var HORIZONTAL:Number = 0

A fast access to AsWingConstants Constant

See also

LEFTproperty 
public static var LEFT:Number = 2

A fast access to AsWingConstants Constant

See also

RIGHTproperty 
public static var RIGHT:Number = 4

A fast access to AsWingConstants Constant

See also

TOPproperty 
public static var TOP:Number = 1

A fast access to AsWingConstants Constant

See also

VERTICALproperty 
public static var VERTICAL:Number = 1

A fast access to AsWingConstants Constant

See also

Method detail
applyTextColor()method
public static function applyTextColor(text:TextField, color:ASColor):void

Parameters
text:TextField
 
color:ASColor
applyTextFont()method 
public static function applyTextFont(text:TextField, font:ASFont):void

Parameters
text:TextField
 
font:ASFont
applyTextFontAndColor()method 
public static function applyTextFontAndColor(text:TextField, font:ASFont, color:ASColor):void

Apply the font and color to the textfield.

Parameters
text:TextField
 
font:ASFont
 
color:ASColor
applyTextFormat()method 
public static function applyTextFormat(text:TextField, textFormat:TextFormat):void

Parameters
text:TextField
 
textFormat:TextFormat
centerLocate()method 
public static function centerLocate(popup:JPopup):void

Locate the popup at center of the stage.

Parameters
popup:JPopup — the popup to be located.
computeStringSize()method 
public static function computeStringSize(tf:TextFormat, str:String, includeGutters:Boolean = true, textField:TextField = null):IntDimension

Computes the text size of specified textFormat, text, and textfield.

Parameters
tf:TextFormat — the textformat of the text
 
str:String — the text to be computes
 
includeGutters:Boolean (default = true) — whether or not include the 2-pixels gutters in the result
 
textField:TextField (default = null) — if a textField is specifed, the embedFonts, antiAliasType, gridFitType, sharpness, and thickness properties of this textField will take effects.

Returns
IntDimension — the computed size of the text
computeStringSizeWithFont()method 
public static function computeStringSizeWithFont(font:ASFont, str:String, includeGutters:Boolean = true):IntDimension

Computes the text size of specified font, text.

Parameters
font:ASFont — the font of the text
 
str:String — the text to be computes
 
includeGutters:Boolean (default = true) — whether or not include the 2-pixels gutters in the result

Returns
IntDimension — the computed size of the text
createLabel()method 
public static function createLabel(parent:DisplayObjectContainer = null, name:String = null):TextField

Create a disabled TextField at specified parent with specified name. The created sprite default property is mouseEnabled=false, selecteable=false, editable=false TextFieldAutoSize.LEFT etc.

Parameters
parent:DisplayObjectContainer (default = null)
 
name:String (default = null)

Returns
TextField — the textfield
createPaneToHold()method 
public static function createPaneToHold(com:Component, layout:LayoutManager, constraints:Object = null):Container

Creates and return a pane to hold the component with specified layout manager and constraints.

Parameters
com:Component
 
layout:LayoutManager
 
constraints:Object (default = null)

Returns
Container
createShape()method 
public static function createShape(parent:DisplayObjectContainer = null, name:String = null):Shape

Create a shape.

Parameters
parent:DisplayObjectContainer (default = null)
 
name:String (default = null)

Returns
Shape — the sprite
createSprite()method 
public static function createSprite(parent:DisplayObjectContainer = null, name:String = null):Sprite

Create a sprite at specified parent with specified name. The created sprite default property is mouseEnabled=false.

Parameters
parent:DisplayObjectContainer (default = null)
 
name:String (default = null)

Returns
Sprite — the sprite
getOwnerAncestor()method 
public static function getOwnerAncestor(c:Component):DisplayObjectContainer

Returns the first popup ancestor or display object root of c, or null if can't find the ancestor

Parameters
c:Component

Returns
DisplayObjectContainer — the first popup ancestor or display object root of c, or null if can't find the ancestor
getOwnerComponent()method 
public static function getOwnerComponent(dis:DisplayObject):Component

Returns the component owner of specified obj.

Parameters
dis:DisplayObject

Returns
Component — the component owner of specified obj.
getPopupAncestor()method 
public static function getPopupAncestor(c:Component):JPopup

Returns the MCPanel ancestor of c, or null if it is not contained inside a mcpanel yet

Parameters
c:Component

Returns
JPopup — the first MCPanel ancestor of c, or null.
getScreenCenterPosition()method 
public static function getScreenCenterPosition():IntPoint

Returns the center position in the stage.

Returns
IntPoint
getStageMousePosition()method 
public static function getStageMousePosition(stage:Stage = null):IntPointParameters
stage:Stage (default = null)

Returns
IntPoint
getVisibleMaximizedBounds()method 
public static function getVisibleMaximizedBounds(dis:DisplayObject = null):IntRectangle

Returns the currently visible maximized bounds in a display object(viewable the stage area).

Note : your stage must be StageAlign.TOP_LEFT align unless this returned value may not be right. Parameters

dis:DisplayObject (default = null) — the display object, default is stage

Returns
IntRectangle
isAncestor()method 
public static function isAncestor(ancestor:Component, child:Component):Boolean

Returns whether or not the ancestor is the child's display ancestor.

Parameters
ancestor:Component
 
child:Component

Returns
Boolean — whether or not the ancestor is the child's display ancestor.
isAncestorComponent()method 
public static function isAncestorComponent(ancestor:Component, child:Component):Boolean

Returns whether or not the ancestor is the child's component ancestor.

Parameters
ancestor:Component
 
child:Component

Returns
Boolean — whether or not the ancestor is the child's component ancestor.
isAncestorDisplayObject()method 
public static function isAncestorDisplayObject(ancestor:DisplayObjectContainer, child:DisplayObject):Boolean

Returns whether or not the ancestor is the child's ancestor.

Parameters
ancestor:DisplayObjectContainer
 
child:DisplayObject

Returns
Boolean — whether or not the ancestor is the child's ancestor.
isDisplayObjectShowing()method 
public static function isDisplayObjectShowing(dis:DisplayObject):Boolean

Returns whethor or not the display object is showing, which means that it is visible and it's ancestors(parent, parent's parent ...) is visible and on stage too.

Parameters
dis:DisplayObject

Returns
Boolean — trun if showing, not then false.
layoutCompoundLabel()method 
public static function layoutCompoundLabel(c:Component, f:ASFont, text:String, icon:Icon, verticalAlignment:int, horizontalAlignment:int, verticalTextPosition:int, horizontalTextPosition:int, viewR:IntRectangle, iconR:IntRectangle, textR:IntRectangle, textIconGap:int):String

Compute and return the location of the icons origin, the location of origin of the text baseline, and a possibly clipped version of the compound labels string. Locations are computed relative to the viewR rectangle.

Parameters
c:Component
 
f:ASFont
 
text:String
 
icon:Icon
 
verticalAlignment:int
 
horizontalAlignment:int
 
verticalTextPosition:int
 
horizontalTextPosition:int
 
viewR:IntRectangle
 
iconR:IntRectangle
 
textR:IntRectangle
 
textIconGap:int

Returns
String
layoutText()method 
public static function layoutText(f:ASFont, text:String, verticalAlignment:Number, horizontalAlignment:Number, viewR:IntRectangle, textR:IntRectangle):String

Compute and return the location of origin of the text baseline, and a possibly clipped version of the text string. Locations are computed relative to the viewR rectangle.

Parameters
f:ASFont
 
text:String
 
verticalAlignment:Number
 
horizontalAlignment:Number
 
viewR:IntRectangle
 
textR:IntRectangle

Returns
String
updateAllComponentUI()method 
public static function updateAllComponentUI(stage:Stage = null):void

When call setLookAndFeel it will not change the UIs at created components. Call this method to update all UIs of components that is on display list or popups.

Parameters
stage:Stage (default = null)

See also

updateAllComponentUIInMemory()method 
public static function updateAllComponentUIInMemory():void

When call setLookAndFeel it will not change the UIs at created components. Call this method to update all UIs of all components in memory whether it is displayable or not. Take care to call this method, because there's may many component in memory since the garbage collector may have not collected some useless components, so it many take a long time to complete updating.

See also

updateChildrenUI()method 
public static function updateChildrenUI(dis:DisplayObject):void

Asks every component that is not a ui element containsed in the display object to updateUI(). This function will search all components contained in the specified object.

Parameters
dis:DisplayObject — the display object

See also

updateComponentTreeUI()method 
public static function updateComponentTreeUI(c:Component):void

A simple minded look and feel change: ask each node in the tree to updateUI() -- that is, to initialize its UI property with the current look and feel.

Parameters
c:Component — the component used to search its owner ancestor

See also

weakRegisterComponent()method 
public static function weakRegisterComponent(c:Component):void

All component will be registered here.

Parameters
c:Component