If you have time to create a simple test case, please post it or file a bug.
________________________________ From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of dbronk Sent: Thursday, September 27, 2007 7:20 AM To: [email protected] Subject: [flexcoders] Re: Very strange runtime behavior - if logic doesn't work????? I'm constructing the boolean as follows: private var includeBase : Boolean = false; Then in my logic to call the filter function I do: includeBase = determineIfBaseNeeded(profile); filterObj.filter(includeBase); The determineIfBaseNeeded is declared as follows: private function determineIfBaseNeeded(profile:Profile) : Boolean { // Do all logic to determine if base is needed or not. // return true/false depending on logic. } The strange thing is I have other place where I have if statements with no else that work just fine. It is almost like the if check is simply checking of the Boolean object exists instead of whether it is true or false. Thanks, Dale --- In [email protected] <mailto:flexcoders%40yahoogroups.com> , shaun <[EMAIL PROTECTED]> wrote: > > Hi, > > How are you constructing your Boolean object? > Are you doing something like: > > var b:Boolean("false"); //true. > > when you want: > > var b:Boolean(false); //false. > > Have a read of the docs for the Boolean constructor if this is how your > creating your Booleans, that might clear things up. > > [snip] > > > My actual code is: > > > > function filter(includeBase:Boolean) : void > > { > > if ( includeBase ) > > { > > // Do a whole lot of stuff here. > > // Including updating bound variables, etc. > > } > > // After if do the rest of my merge process. > > } > > > > My problem was that if I passed in true or false, it always went into > > the true block of the if statement. So that is when I created my test > > function of crazy. So let's forget about that test function > > (although, there were not dup names. One var is "s", the other is "ss"). > > > > So, my function has several things it will be doing inside of the true > > portion of the if statement, and then whether or not it was true or > > false, continue with other processes. After creating my "crazy" test > > function I then came back and modified my function to: > > function filter(includeBase:Boolean) : void > > { > > if ( includeBase ) > > { > > // Do a whole lot of stuff here. > > // Including updating bound variables, etc. > > } > > else > > { > > // HACK FOR AN APPARENT BUG! > > // Not sure why, but this if statement will always resolve to > > true unless there is an else. > > var whoKnowsWhy : String; > > } > > // After if do the rest of my merge process. > > } > > > > Once I did this, my code works great. includeBase of true and it will > > go into the true block. includeBase of false and it will go into the > > false block. > > I find this very very hard to beleive. I'm betting you changed the way > your exercising the code (ie) by passing in an explicit false or true to > the function. > > [snip] > > HTH. > - shaun >

