Packagecom.gestureworks.cml.utils
Classpublic class DisplayUtils
InheritanceDisplayUtils Inheritance Object

...



Public Methods
 MethodDefined By
  
DisplayUtils
  
addChildren(container:DisplayObjectContainer, children:Array):void
[static] Add an array of children to a container
DisplayUtils
  
getAllChildren(container:DisplayObjectContainer):Array
[static] Returns all children of a container
DisplayUtils
  
getAllChildrenByType(container:DisplayObjectContainer, type:Class, recursive:Boolean = false):Array
[static] Returns all children of a specific type from a container.
DisplayUtils
  
getCenterPoint(obj:*):Point
[static] Returns the center point of the object
DisplayUtils
  
getParentType(type:Class, obj:*):*
[static] Returns the first parent of the specified type
DisplayUtils
  
isVisible(obj:DisplayObject):Boolean
[static] Check if a display object is visible.
DisplayUtils
  
pointRotateMatrix(angle:Number, aroundX:Number, aroundY:Number, m:Matrix = null):Matrix
[static] Returns a matrix rotated around a specific point at a specific angle
DisplayUtils
  
relativePos(obj1:DisplayObject, obj2:DisplayObject):Point
[static] Returns relative position as a point between two display objects
DisplayUtils
  
removeAllChildren(container:DisplayObjectContainer, leave:int = 0):Array
[static] Removes all children from a container and leave the bottom few
DisplayUtils
  
removeAllChildrenByType(container:DisplayObjectContainer, type:Class):Array
[static] Removes all children of a specific type from a container.
DisplayUtils
  
rotateAroundCenter(obj:*, angle:Number):void
[static] Rotates an object around it's center point at a specific angle of rotation
DisplayUtils
  
rotateAroundPoint(obj:*, angle:Number, aroundX:Number, aroundY:Number):void
[static] Rotates an object around a spcecific point at a specific angle of rotation
DisplayUtils
  
scheduleForNextFrame(callback:Function):void
[static] Wait for a next frame.
DisplayUtils
  
toBitmap(obj:DisplayObject, smoothing:Boolean = true):Bitmap
[static] Converts display object to bitmap data and return bitmap
DisplayUtils
  
traceDisplayList(container:DisplayObjectContainer, indentString:String):void
Recursively traces display list from input container
DisplayUtils
Constructor Detail
DisplayUtils()Constructor
public function DisplayUtils()



Method Detail
addChildren()method
public static function addChildren(container:DisplayObjectContainer, children:Array):void

Add an array of children to a container

Parameters

container:DisplayObjectContainer — Container to add to
 
children:Array — the child array

getAllChildren()method 
public static function getAllChildren(container:DisplayObjectContainer):Array

Returns all children of a container

Parameters

container:DisplayObjectContainer

Returns
Array
getAllChildrenByType()method 
public static function getAllChildrenByType(container:DisplayObjectContainer, type:Class, recursive:Boolean = false):Array

Returns all children of a specific type from a container.

Parameters

container:DisplayObjectContainer — Container
 
type:Class — type of children
 
recursive:Boolean (default = false)

Returns
Array
getCenterPoint()method 
public static function getCenterPoint(obj:*):Point

Returns the center point of the object

Parameters

obj:* — the object

Returns
Point — the object's center point
getParentType()method 
public static function getParentType(type:Class, obj:*):*

Returns the first parent of the specified type

Parameters

type:Class
 
obj:*

Returns
* — the parent if the parent of type exists, null otherwise
isVisible()method 
public static function isVisible(obj:DisplayObject):Boolean

Check if a display object is visible. This checks all of its parents' visibilities.

Parameters

obj:DisplayObject — Display object to check

Returns
Boolean
pointRotateMatrix()method 
public static function pointRotateMatrix(angle:Number, aroundX:Number, aroundY:Number, m:Matrix = null):Matrix

Returns a matrix rotated around a specific point at a specific angle

Parameters

angle:Number — the angle of rotation
 
aroundX:Number — the x coordinate of the point to rotate around
 
aroundY:Number — the y coordinate of the point to rotate around
 
m:Matrix (default = null) — the matrix to rotate

Returns
Matrix
relativePos()method 
public static function relativePos(obj1:DisplayObject, obj2:DisplayObject):Point

Returns relative position as a point between two display objects

Parameters

obj1:DisplayObject
 
obj2:DisplayObject

Returns
Point
removeAllChildren()method 
public static function removeAllChildren(container:DisplayObjectContainer, leave:int = 0):Array

Removes all children from a container and leave the bottom few

Parameters

container:DisplayObjectContainer — Container to remove from
 
leave:int (default = 0) — (optional) Number of bottom children to leave

Returns
Array
removeAllChildrenByType()method 
public static function removeAllChildrenByType(container:DisplayObjectContainer, type:Class):Array

Removes all children of a specific type from a container.

Parameters

container:DisplayObjectContainer — Container to remove from
 
type:Class — type of children to remove

Returns
Array

Example
         var s:Sprite = new Sprite();
         s.addChild(new Shape());
         s.addChild(new Shape());
         s.addChild(new MovieClip());
         s.addChild(new Sprite());
         //trace(s.numChildren); // 4
         removeAllChildrenByType(s, Shape);
         //trace(s.numChildren); // 2
         
rotateAroundCenter()method 
public static function rotateAroundCenter(obj:*, angle:Number):void

Rotates an object around it's center point at a specific angle of rotation

Parameters

obj:* — the object to rotate
 
angle:Number — the angle of rotation

rotateAroundPoint()method 
public static function rotateAroundPoint(obj:*, angle:Number, aroundX:Number, aroundY:Number):void

Rotates an object around a spcecific point at a specific angle of rotation

Parameters

obj:* — the object to rotate
 
angle:Number — the angle of rotation
 
aroundX:Number — the x coordinate of the point to rotate around
 
aroundY:Number — the y coordinate of the point to rotate around

scheduleForNextFrame()method 
public static function scheduleForNextFrame(callback:Function):void

Wait for a next frame. Prevents high CPU state, when AVM doesn't send ENTER_FRAMES. It just simply waits until it gets one.

Parameters

callback:Function — Function to call once when next frame is displayed

toBitmap()method 
public static function toBitmap(obj:DisplayObject, smoothing:Boolean = true):Bitmap

Converts display object to bitmap data and return bitmap

Parameters

obj:DisplayObject
 
smoothing:Boolean (default = true)

Returns
Bitmap
traceDisplayList()method 
public function traceDisplayList(container:DisplayObjectContainer, indentString:String):void

Recursively traces display list from input container

Parameters

container:DisplayObjectContainer
 
indentString:String