Would you like to tell us how we are doing?

You bet No thanks
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:
BlackBerry 10 Version:   10.0.0



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
  
getDisplayAsset(_class:Class):DisplayObject
[static] Returns an instance of the supplied class as a DisplayObject.
DisplayObjectUtils
  
getNestLevel(target:Object):int
[static] Returns how many levels deep the target object is in the display hiearchy.
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, flash.utils.getDefinitionByName will be used to try and determine a class to use.
  • 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 the linkage is a string, an ArgumentError is thrown. If the linkage is a string and 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.

getDisplayAsset()


public static function getDisplayAsset(_class:Class):DisplayObject

Returns an instance of the supplied class as a DisplayObject. If the class evaluates to a Bitmap its BitmapData is stored in a cache. Successive calls to this function with the same Bitmap class will retrieve the BitmapData from the class and return it in a Bitmap.

Parameters

_class:Class — Class The class of which an instance is requested to be created

Returns

DisplayObject — an instance of the supplied Class as a DisplayObject.

getNestLevel()


public static function getNestLevel(target:Object):int

Returns how many levels deep the target object is in the display hiearchy.

Parameters

target:Object — The target whose nesting level you wish to know

Returns

int — The nesting level of the supplied target.

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.