Packagetwaver.threed.util
Classpublic class Util3D
InheritanceUtil3D Inheritance Object

Util3D is designed to provide some tool functions to help programmers develope applications..



Public Methods
 MethodDefined By
  
addEventListener(type:String, listener:Function):void
[static] Adds a global event listener.
Util3D
  
dispatchEvent(evt:Event):void
[static] Fires a global event.
Util3D
  
getColor(r:int, g:int, b:int):uint
[static] Gets color value as an uint by the specified RGB value.
Util3D
  
getFirstSelectedElement(box:ElementBox, e:SelectionChangeEvent):Element
[static] Gets the first selected element according to a SelectionChangedEvent object.
Util3D
  
getPropertyName(evt:PropertyChangeEvent):String
[static] Gets the property name of a PropertyChangeEvent object.
Util3D
  
getRandomBetween(min:Number, max:Number):Number
[static] Gets a random number between the specified minimum and maximum.
Util3D
  
getSelectedElements(box:ElementBox, e:SelectionChangeEvent):Array
[static]
Util3D
  
getSimpleCircle(r:Number):Array
[static] Gets an array of points which make up a circle on x-z plane.
Util3D
  
getValueWithDefault(e:*, pro:String):*
[static] Gets the style value of a specified element or the global value.
Util3D
  
isPermission3D():Boolean
[static]
Util3D
  
[static] Used to pre-register the value types of 3D styles.
Util3D
  
removeEventListener(type:String, listener:Function):void
[static] Removes a global event listener.
Util3D
  
validateLicense(license:*):Boolean
[static]
Util3D
Method Detail
addEventListener()method
public static function addEventListener(type:String, listener:Function):void

Adds a global event listener.

		 For example:
		 Util3D.addEventListener(ModelLoadEvent.LOAD_ERROR,onError);
		 private function onError(evt:ModelLoadEvent):void{
				trace(evt.cause);
			}
		 

Parameters

type:String
 
listener:Function

dispatchEvent()method 
public static function dispatchEvent(evt:Event):void

Fires a global event.

Parameters

evt:Event — Event The Event object which is dispatched in globla scope.

getColor()method 
public static function getColor(r:int, g:int, b:int):uint

Gets color value as an uint by the specified RGB value.

Parameters

r:int — int the specified red value.
 
g:int — int the specified green value.
 
b:int — int the specified blue value.

Returns
uint — uint the expected color value.
getFirstSelectedElement()method 
public static function getFirstSelectedElement(box:ElementBox, e:SelectionChangeEvent):Element

Gets the first selected element according to a SelectionChangedEvent object.

Parameters

box:ElementBox
 
e:SelectionChangeEvent

Returns
Element — twaver.Element. The expected first selected element.
getPropertyName()method 
public static function getPropertyName(evt:PropertyChangeEvent):String

Gets the property name of a PropertyChangeEvent object.

Parameters

evt:PropertyChangeEvent — PropertyChangeEvent The specified PropertyChangeEvent object.

Returns
String — String. The expected property name.
getRandomBetween()method 
public static function getRandomBetween(min:Number, max:Number):Number

Gets a random number between the specified minimum and maximum.

Parameters

min:Number
 
max:Number

Returns
Number — Number The expected random number.
getSelectedElements()method 
public static function getSelectedElements(box:ElementBox, e:SelectionChangeEvent):Array

Parameters

box:ElementBox
 
e:SelectionChangeEvent

Returns
Array
getSimpleCircle()method 
public static function getSimpleCircle(r:Number):Array

Gets an array of points which make up a circle on x-z plane.

Parameters

r:Number — Number. The specified radius of the circle.

Returns
Array — Array. The single path of the expected circle, and it is filled with Vector3D values.
getValueWithDefault()method 
public static function getValueWithDefault(e:*, pro:String):*

Gets the style value of a specified element or the global value.

Parameters

e:*
 
pro:String

Returns
*
isPermission3D()method 
public static function isPermission3D():Boolean

Returns
Boolean
registVector3D()method 
public static function registVector3D():void

Used to pre-register the value types of 3D styles. If developers want to use the XMLSerializer3D to export or import a 3D scene, this method should be invoked at first.

removeEventListener()method 
public static function removeEventListener(type:String, listener:Function):void

Removes a global event listener.

Parameters

type:String
 
listener:Function

validateLicense()method 
public static function validateLicense(license:*):Boolean

Parameters

license:*

Returns
Boolean