I wrote a function to change state of details based on arg[0]
(off_on):
true - show
false - hide
null - toggle
Seems ok, but if off_on is declared Boolean we get a warning: "1096:
Illogical comparison with null. Variables of type Boolean cannot be
null."
Shucks ... ":(~
So I now have my function as follows, and it works ok, but type
checking is obviously lost because I dont define off_on:Boolean.
01 public function toggleDetails(off_on:* = null):void{
02 if(off_on === null){
03 details = !details;
04 } else {
05 details = off_on;
06 }
07 }
It would be nice to be able to specify Boolean because I am perfectly
satified with true|false|empty. I am also dissapointed to see the
compiler complain that I check for null on line 02. Why do I feel
that is a bad thing? Because what if my Boolean value is
uninitialized? (e.g. var b:Boolean;toggleDetails(b); )
Thanks in advance... and I'll save 2+n parameter questions for
another post...