meddlingwithfir
10-27-2006, 07:39 PM
Maybe I'm not getting this.
var testTrue:Boolean = new Boolean("true");
var testFalse:Boolean = new Boolean("false");
Alert.show(testTrue.toString(), "testTrue"); // displays true
Alert.show(testFalse.toString(), "testFalse"); // displays true
Doesn't this just seem wrong?
I've looked at the documentation, and I see why it happens (http://livedocs.macromedia.com/flex/2/langref/package.html). Any non-empty string returns true. Which is a royal pain when grabbing values from ColdFusion CFC's. I build a function that returns a Boolean -- I call this function using the Flash Remoting option, and the ResultEvent that it comes back with creates the result as a String object, not a Boolean. So I have to create "lengthy" String comparison code to determine what I actually got back!
switch (event.result)
{
case "true":
isLoggedIn = true;
break;
default:
isLoggedIn = false;
break;
}
Maybe I'm just a complainer, but that global Boolean() function looks poorly written to me.
var testTrue:Boolean = new Boolean("true");
var testFalse:Boolean = new Boolean("false");
Alert.show(testTrue.toString(), "testTrue"); // displays true
Alert.show(testFalse.toString(), "testFalse"); // displays true
Doesn't this just seem wrong?
I've looked at the documentation, and I see why it happens (http://livedocs.macromedia.com/flex/2/langref/package.html). Any non-empty string returns true. Which is a royal pain when grabbing values from ColdFusion CFC's. I build a function that returns a Boolean -- I call this function using the Flash Remoting option, and the ResultEvent that it comes back with creates the result as a String object, not a Boolean. So I have to create "lengthy" String comparison code to determine what I actually got back!
switch (event.result)
{
case "true":
isLoggedIn = true;
break;
default:
isLoggedIn = false;
break;
}
Maybe I'm just a complainer, but that global Boolean() function looks poorly written to me.