IMHO, that's not a test case because it doesn't compile.  I made enough
changes to get it to compile and it does not show your problem.  For a
strange situation like this, your test case must compile, otherwise I
get suspicious that you're ignoring a build error and debugging an old
swf against newer source.

________________________________

From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of dbronk
Sent: Thursday, September 27, 2007 11:19 AM
To: [email protected]
Subject: [flexcoders] Re: Very strange runtime behavior - if logic
doesn't work?????



hmmm... I thought I did post a test case. I didn't send in a bug report.

Here is the meaningful part of my mxml:
<?xml version="1.0" encoding="utf-8"?>
<mx:Application 
layout="absolute" 
width="100%" height="100%"
xmlns:mx="http://www.adobe.com/2006/mxml
<http://www.adobe.com/2006/mxml> " 
xmlns:appView="com.tf.app.view.*"
xmlns:appServices="com.tf.app.business.*"
creationComplete="init()">

<mx:Style source="assets/css/tf.css"/>
<mx:Style source="assets/css/fonts.css"/>

<mx:Script>
<![CDATA[
import com.tf.util.FilterUtils;

private function init() : void
{
var includeBase : Boolean = determineIfBaseNeeded();
var filterUtils : FilterUtils(); 
filterUtils.filter(includeBase);
}

private function determineIfBaseNeeded() : Boolean
{
// I simply toggle this back and forth until my logic
is ready.
//return true;
return false;
}
]]>
</mx:Script>
<!-- the rest of my UI here -->
</mx:Application>

My FilterUtils class is as follows:

package com.tf.util
{

public class FilterUtils
{
function filter(includeBase:Boolean) : void
{
var filterData : ArrayCollection = new ArrayCollection()
if ( includeBase )
{
filterData.add(Models.getInstance().base);
// Do a whole lot of stuff here.
// Including updating bound variables, etc.
}
// After if do the rest of my merge process.
// Actually filtering the data and adding to filterData
Models.getInstance().filteredData = filterData;
}
}

--- In [email protected] <mailto:flexcoders%40yahoogroups.com>
, "Alex Harui" <[EMAIL PROTECTED]> wrote:
>
> If you have time to create a simple test case, please post it or file
a
> bug.
> 
> ________________________________
> 
> From: [email protected] <mailto:flexcoders%40yahoogroups.com>
[mailto:[email protected] <mailto:flexcoders%40yahoogroups.com>
] On
> Behalf Of dbronk
> Sent: Thursday, September 27, 2007 7:20 AM
> To: [email protected] <mailto:flexcoders%40yahoogroups.com> 
> 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>
<mailto:flexcoders%40yahoogroups.com>
> , shaun <shaun@> 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
> >
>



 

Reply via email to