Hello All,
  I've been running into a rather frustrating issue with flex: namely
that although data types are supposedly implemented as AS classes, you
cannot null variables of primitive data types e.g.

var blah:int =  null;       //blah == 0
var blah:Number = null;     //blah == 0
var blah:Boolean = null;    //blah == false

admittedly we can define -1 as null for non-Boolean types, but what if
a negative number becomes a logical value in some case?

now this wouldn't be a problem if we didn't have to communicate with a
SQL back-end, but sometimes I need to be able to pass a null value to
the db either to signify that the current value shouldn't be changed
or to specify that information is not currently known for the value.

my initial solution was going to be extending the String class to
create classes like NullableBoolean, which would check for a valid
boolean value and failing that accept null and nothing else, then
override the toString() function. Unfortunately, the String class is
declared final and cannot be extended. Even if this were not true,
it's not apparent how I could catch an assignment event and process
it, since there are no public get/set functions in the String class.

so now I'm leaning toward using dynamic Object properties that have no
explicit type, and I find this extremely unfortunate because I lose
both error checking and auto-completion features in FlexBuilder.

does anyone have a solution to this that doesn't involve some crazily
far-out hack? Seems to me that the flex data types are a far cry from
being robust.

Thanks for your time,
Pixels

Reply via email to