Packagesekati.utils
Classpublic class DisplayUtil

Static class wrapping various DisplayObject utilities.



Public Methods
 MethodDefined by
  
DisplayUtil Static Constructor
DisplayUtil
  
addChildren(o:DisplayObjectContainer, ... args):void
[static] A bulk addChild
DisplayUtil
  
color(mc:DisplayObject, color:uint):void
[static] Change the color of a display object, works when setting the color property of the colorTransform does not, for "stubborn" elements.
DisplayUtil
  
getClassFromInstance(instance:DisplayObject, requiredSubclass:Class = null):Class
[static] Useful for templated items, returns the Class object that a DisplayObject instance is an instance of.
DisplayUtil
  
getMovieFromLibrary(className:String):Sprite
[static] Instantiate a Sprite symbol from the library by string name.
DisplayUtil
  
getNextHighestDepth(o:DisplayObjectContainer):uint
[static] Return the next highest depth.
DisplayUtil
  
makeButton(o:Sprite, enabled:Boolean = true):void
[static] Turns button behavior of a sprite on/off.
DisplayUtil
  
removeChildren(o:DisplayObjectContainer):void
[static] Removes all display children from a container.
DisplayUtil
  
reParentDisplayObject(object:DisplayObject, newParent:DisplayObjectContainer):void
[static] Reparent a display object while maintianing its visual continuity by syncing it's scale & rotation properties.
DisplayUtil
  
sizeContent(o:DisplayObject, child:DisplayObject = null):void
[static] Re-scales elements on the timeline to 100% and then resizes to fit the previously stretched dimensions.
DisplayUtil
  
unparentDisplayObjects(... args):void
[static] Unparents all arguments passed into the method.
DisplayUtil
Constructor detail
DisplayUtil()constructor
public function DisplayUtil()

DisplayUtil Static Constructor

Method detail
addChildren()method
public static function addChildren(o:DisplayObjectContainer, ... args):void

A bulk addChild

Parameters
o:DisplayObjectContainer — destination object.
 
... args — array of DisplayObjects to add to the destination.
color()method 
public static function color(mc:DisplayObject, color:uint):void

Change the color of a display object, works when setting the color property of the colorTransform does not, for "stubborn" elements.

Parameters
mc:DisplayObject
 
color:uint
getClassFromInstance()method 
public static function getClassFromInstance(instance:DisplayObject, requiredSubclass:Class = null):Class

Useful for templated items, returns the Class object that a DisplayObject instance is an instance of. You can pass another class to ensure that the class is a subclass or implementor of a certain class or interface.

Parameters
instance:DisplayObject
 
requiredSubclass:Class (default = null)

Returns
Class
getMovieFromLibrary()method 
public static function getMovieFromLibrary(className:String):Sprite

Instantiate a Sprite symbol from the library by string name.

Parameters
className:String

Returns
Sprite

Example
   var myBox : Sprite = DisplayUtil.getMovieFromLibrary( "Box" );
   addChild( myBox );
   

getNextHighestDepth()method 
public static function getNextHighestDepth(o:DisplayObjectContainer):uint

Return the next highest depth.

Parameters
o:DisplayObjectContainer

Returns
uint

Example
;
    this.setChildIndex( mySprite,  DisplayUtil.getNextHighestDepth( mySprite ) );
   

makeButton()method 
public static function makeButton(o:Sprite, enabled:Boolean = true):void

Turns button behavior of a sprite on/off.

Parameters
o:Sprite
 
enabled:Boolean (default = true)
removeChildren()method 
public static function removeChildren(o:DisplayObjectContainer):void

Removes all display children from a container.

Parameters
o:DisplayObjectContainer
reParentDisplayObject()method 
public static function reParentDisplayObject(object:DisplayObject, newParent:DisplayObjectContainer):void

Reparent a display object while maintianing its visual continuity by syncing it's scale & rotation properties.

Parameters
object:DisplayObject
 
newParent:DisplayObjectContainer
sizeContent()method 
public static function sizeContent(o:DisplayObject, child:DisplayObject = null):void

Re-scales elements on the timeline to 100% and then resizes to fit the previously stretched dimensions.

Parameters
o:DisplayObject — the stretched DisplayObject.
 
child:DisplayObject (default = null) — if there are children of the movie, they are also stretched.
unparentDisplayObjects()method 
public static function unparentDisplayObjects(... args):void

Unparents all arguments passed into the method.

Parameters
... args