Boolean cannot be null. The default value is false if not initialised. I think you want to use int with predefined constants.
On 4/22/07, Muzak <[EMAIL PROTECTED]> wrote: > Use int instead of Boolean ? > > -1 (instead of null) > 0 (instead of false) > 1 (instead of true) > > regards, > Muzak > > > > ----- Original Message ----- > From: "Shannon" <[EMAIL PROTECTED]> > To: <[email protected]> > Sent: Sunday, April 22, 2007 8:11 AM > Subject: [flexcoders] Booleans and Stardust > > > 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... > > > > > > -- > Flexcoders Mailing List > FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt > Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com > Yahoo! Groups Links > > > >

