Packageorg.apache.flex.utils
Classpublic class UIDUtil
InheritanceUIDUtil Inheritance Object

Language Version : ActionScript 3.0
Product Versions : Flex 3, FlexJS 0.0
Runtime Versions : Flash Player 9, AIR 1.1

The UIDUtil class is an all-static class with methods for working with UIDs (unique identifiers) within Flex. You do not create instances of UIDUtil; instead you simply call static methods such as the UIDUtil.createUID() method.

Note: If you have a dynamic object that has no [Bindable] properties (which force the object to implement the IUID interface), Flex adds an mx_internal_uid property that contains a UID to the object. To avoid having this field in your dynamic object, make it [Bindable], implement the IUID interface in the object class, or set a property with a value.



Public Methods
 MethodDefined By
  
createUID():String
[static] Generates a UID (unique identifier) based on ActionScript's pseudo-random number generator and the current time.
UIDUtil
  
[static] Converts a 128-bit UID encoded as a ByteArray to a String representation.
UIDUtil
  
isUID(uid:String):Boolean
[static] A utility method to check whether a String value represents a correctly formatted UID value.
UIDUtil
  
toBinary(uid:String):BinaryData
[static] Converts a UID formatted String to a BinaryData.
UIDUtil
Method Detail
createUID()method
public static function createUID():String

Language Version : ActionScript 3.0
Product Versions : Flex 3, FlexJS 0.0
Runtime Versions : Flash Player 9, AIR 1.1

Generates a UID (unique identifier) based on ActionScript's pseudo-random number generator and the current time.

The UID has the form "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX" where X is a hexadecimal digit (0-9, A-F).

This UID will not be truly globally unique; but it is the best we can do without player support for UID generation.

Returns
String — The newly-generated UID.
fromBinary()method 
public static function fromBinary(ba:BinaryData):String

Language Version : ActionScript 3.0
Product Versions : Flex 3, FlexJS 0.0
Runtime Versions : Flash Player 9, AIR 1.1

Converts a 128-bit UID encoded as a ByteArray to a String representation. The format matches that generated by createUID. If a suitable ByteArray is not provided, null is returned.

Parameters

ba:BinaryData — ByteArray 16 bytes in length representing a 128-bit UID.

Returns
String — String representation of the UID, or null if an invalid ByteArray is provided.
isUID()method 
public static function isUID(uid:String):Boolean

Language Version : ActionScript 3.0
Product Versions : Flex 3, FlexJS 0.0
Runtime Versions : Flash Player 9, AIR 1.1

A utility method to check whether a String value represents a correctly formatted UID value. UID values are expected to be in the format generated by createUID(), implying that only capitalized A-F characters in addition to 0-9 digits are supported.

Parameters

uid:String — The value to test whether it is formatted as a UID.

Returns
Boolean — Returns true if the value is formatted as a UID.
toBinary()method 
public static function toBinary(uid:String):BinaryData

Language Version : ActionScript 3.0
Product Versions : Flex 3, FlexJS 0.0
Runtime Versions : Flash Player 9, AIR 1.1

Converts a UID formatted String to a BinaryData. The UID must be in the format generated by createUID, otherwise null is returned.

Parameters

uid:String — representing a 128-bit UID

Returns
BinaryData — ByteArray 16 bytes in length representing the 128-bits of the UID or null if the uid could not be converted.