qnx.fuse.ui.utils.DisplayObjectUtils

DisplayObjectUtils

Methods


Packageqnx.fuse.ui.utils
Classpublic class DisplayObjectUtils
InheritanceDisplayObjectUtils Inheritance Object

DisplayObjectUtils contains utility methods for DisplayObjects

Class information:
PlayBook Tablet OS Version:   1.0.6



Public Methods

 MethodDefined By
  
createInstance(linkage:Object, target:DisplayObject = null):DisplayObject
[static] Calling this method will attempt to create a DisplayObject instance based on the value of the linkage parameter.
DisplayObjectUtils
  
getNestLevel(target:Object):int
[static] Returns the level at which hierarchical
DisplayObjectUtils
  
getUnscaledHeight(target:DisplayObject):Number
[static] Returns the height of the supplied DisplayObject before it was scaled.
DisplayObjectUtils
  
getUnscaledWidth(target:DisplayObject):Number
[static] Returns the width of the supplied DisplayObject before it was scaled.
DisplayObjectUtils

Method Detail

createInstance()


public static function createInstance(linkage:Object, target:DisplayObject = null):DisplayObject

Calling this method will attempt to create a DisplayObject instance based on the value of the linkage parameter.

The linkage parameter can be one of three different types: Class, String, or DisplayObject instance.

  • If you pass in a Class, a new instance of that class is created and returned.
  • If you pass in a String, the flash.utils.getDefinitionByName will attempt to create a new method.
  • If you pass in a DisplayObject instance, the x and y values of the instance are set to 0 and returned.

The target parameter required to be set only when the linkage is a String and class cannot be found in the current application domain. This method first tries to find the class to instaniate by calling getDefinitionByName( String( linkage ) ). If this method throws an error it tries the following target.loaderInfo.applicationDomain.getDefinition( String( linkage ) ). If target is null and Argument error is thrown. If the class is not found an Error is thrown.

Parameters

linkage:Object — The instance to create.
target:DisplayObject (default = null) — The target to use to get the loaderInfo property.

Returns

DisplayObject — A DisplayObject instance of the specified object.

Throws

ArgumentError — Thrown when the target is null and the class is not found in the current application domain.
Error — Thrown when if the class cannot be found when linkage is of type String and the class cannot be found.

getNestLevel()


public static function getNestLevel(target:Object):int

Returns the level at which hierarchical

Parameters

target:Object

Returns

int

getUnscaledHeight()


public static function getUnscaledHeight(target:DisplayObject):Number

Returns the height of the supplied DisplayObject before it was scaled. This is useful for determining the original height of the object.

Parameters

target:DisplayObject — A DisplayObject to measure the unscaled height of.

Returns

Number — The unscaled height of the DisplayObject.

getUnscaledWidth()


public static function getUnscaledWidth(target:DisplayObject):Number

Returns the width of the supplied DisplayObject before it was scaled. This is useful for determining the original width of the object.

Parameters

target:DisplayObject — A DisplayObject to measure the unscaled width of.

Returns

Number — The unscaled width of the DisplayObject.