Packagevegas.util
Classpublic class TypeUtil

The TypeUtil utility class is an all-static class with methods for checking and working with the type of the object in AS2.



Public Methods
 MethodDefined by
  
compare(o1:*, o2:*):Boolean
[static] Compares the types of two objects.
TypeUtil
  
isExplicitInstanceOf(o:*, c:*):Boolean
[static] Checks if the passed-in object is an explicit instance of the passed-in class.
TypeUtil
  
isGenericObject(o:*):Boolean
[static] Checks if the passed-in object is a generic object.
TypeUtil
  
isInstanceOf(o:*, type:*):Boolean
[static] Checks if the passed-in object is an instance of the passed-in type.
TypeUtil
  
isPrimitive(o:*):Boolean
[static] Checks if the passed-in object is a primitive type.
TypeUtil
  
isTypeOf(o:*, type:String):Boolean
[static] Checks if the result of an execution of the typeof method on the passed-in object matches the passed-in type.
TypeUtil
  
typesMatch(o:*, type:*):Boolean
[static] Checks if the type of the passed-in object matches the passed-in type.
TypeUtil
Public Constants
 ConstantDefined by
  BOOLEAN : String = "boolean"
[static] The type of the 'boolean' objects.
TypeUtil
  DATE : String = "date"
[static] The type of the 'date' objects.
TypeUtil
  ERROR : String = "error"
[static] The type of the 'error' objects.
TypeUtil
  FUNCTION : String = "function"
[static] The type of the 'function' objects.
TypeUtil
  INT : String = "int"
[static] The type of the 'int' objects.
TypeUtil
  NULL : String = "null"
[static] The type of the 'null' objects.
TypeUtil
  NUMBER : String = "number"
[static] The type of the 'number' objects.
TypeUtil
  OBJECT : String = "object"
[static] The type of the 'object' objects.
TypeUtil
  STRING : String = "string"
[static] The type of the 'string' objects.
TypeUtil
  UINT : String = "uint"
[static] The type of the 'uint' objects.
TypeUtil
  UNDEFINED : String = "undefined"
[static] The type of the 'undefined' objects.
TypeUtil
  XML : String = "xml"
[static] The type of the 'xml' objects.
TypeUtil
Method detail
compare()method
public static function compare(o1:*, o2:*):Boolean

Compares the types of two objects.

Parameters
o1:*
 
o2:*

Returns
Booleantrue if the two objects are the same primitive type.
isExplicitInstanceOf()method 
public static function isExplicitInstanceOf(o:*, c:*):Boolean

Checks if the passed-in object is an explicit instance of the passed-in class.

Parameters
o:*
 
c:*

Returns
Booleantrue if the passed-in object is an explicit instance of the passed-in class.
isGenericObject()method 
public static function isGenericObject(o:*):Boolean

Checks if the passed-in object is a generic object.

Parameters
o:*

Returns
Booleantrue if the passed-in object is a generic object.
isInstanceOf()method 
public static function isInstanceOf(o:*, type:*):Boolean

Checks if the passed-in object is an instance of the passed-in type.

Parameters
o:*
 
type:*

Returns
Booleantrue if the passed-in object is an instance of the passed-in type.
isPrimitive()method 
public static function isPrimitive(o:*):Boolean

Checks if the passed-in object is a primitive type.

Parameters
o:*

Returns
Booleantrue if the passed-in object is a primitive type.
isTypeOf()method 
public static function isTypeOf(o:*, type:String):Boolean

Checks if the result of an execution of the typeof method on the passed-in object matches the passed-in type.

Parameters
o:*
 
type:String

Returns
Booleantrue if the result of an execution of the typeof method on the passed-in object matches the passed-in type.
typesMatch()method 
public static function typesMatch(o:*, type:*):Boolean

Checks if the type of the passed-in object matches the passed-in type.

Example : import vegas.util.TypeUtil ; var s1:String = "hello world" ; var s2:String = new String("hello world") ; trace("s1 is string : " + TypeUtil.typesMatch( s1, String )) ; // output : 'true' trace("s2 is string : " + TypeUtil.typesMatch( s2, String )) ; // output : 'true'

Parameters
o:*
 
type:*

Returns
Boolean
Constant detail
BOOLEANconstant
public static const BOOLEAN:String = "boolean"

The type of the 'boolean' objects.

DATEconstant 
public static const DATE:String = "date"

The type of the 'date' objects.

ERRORconstant 
public static const ERROR:String = "error"

The type of the 'error' objects.

FUNCTIONconstant 
public static const FUNCTION:String = "function"

The type of the 'function' objects.

INTconstant 
public static const INT:String = "int"

The type of the 'int' objects.

NULLconstant 
public static const NULL:String = "null"

The type of the 'null' objects.

NUMBERconstant 
public static const NUMBER:String = "number"

The type of the 'number' objects.

OBJECTconstant 
public static const OBJECT:String = "object"

The type of the 'object' objects.

STRINGconstant 
public static const STRING:String = "string"

The type of the 'string' objects.

UINTconstant 
public static const UINT:String = "uint"

The type of the 'uint' objects.

UNDEFINEDconstant 
public static const UNDEFINED:String = "undefined"

The type of the 'undefined' objects.

XMLconstant 
public static const XML:String = "xml"

The type of the 'xml' objects.