2008
05.14

UINT

Found a nice way to use uints’ default value to my advantage. Have started using them for all my identifier constants in my apps. As they default to 0 (zero) even when uninitialised, as long as I make sure all my constants have a minimum value of 1, all I need to do is set up a global NULL constant of 0 and compare any class properties to that.
I can test properties regardless whether they’ve been initialised or not, so no more looking for nulls or empty strings, etc.

[as]public static const NULL:uint = 0;
public static const STATE_LOADING:uint = 1;
public static const STATE_LOADED:uint = 2;
public var state:uint;
//check state before it has been set:
trace( state == NULL ); // true – not inititalised [/as]

No Comment.

Add Your Comment