Ok, a night of sleep and your comments cleared things up. I have the
else if statement because in the future we might add a third image
"yellow_dot.jpg" if all the other conditions fail.

What I did is just put in return statements after each assignment
statement and it works perfectly.

Thanks for your help.

J

--- In [email protected], "Tim Hoff" <[EMAIL PROTECTED]> wrote:
>
> Hey Jason,
> 
> It looks like you are setting the image source to null everytime, 
> after your conditional statements.  Also, you don't need else if.  
> Just using else would work in this situation.
> 
> -TH
> 
> --- In [email protected], "jnewport" <jason_newport@> 
> wrote:
> >
> > Ok I am going nuts here.  Can use another set of eyes for something
> > that should be easy.  I am overwriting the set data method for my
> > itemRenderer like so:
> > 
> >             //Overrride the set method for the data property so 
> that when
> > scrolling nothing changes
> >             override public function set data(value:Object):void
> >             {
> >                             super.data = value;
> >                             if(value != null)
> >                             {
> >                                     var currentValue:Number = 
> value.perchange;
> >                                     trace(currentValue);
> >                                     toolTip=currentValue.toString
> ();
> >                                     if(currentValue < 0)
> >                                     {
> >                                             image.source = 
> negativeAmountSymbol;
> >                                     } else if(currentValue >= 0){
> >                                             image.source = 
> positiveAmountSymbol;
> >                                     }
> >                                     image.source = null;
> >                             }
> >             }
> >     }
> > 
> > 
> > Here is my data provider:
> > 
> >     public var CityData:ArrayCollection = new ArrayCollection([
> >         {
> >           title: "cycle 1", perchange: -32,
> >           revenue:[
> >             { Month: "Jan", Revenue: 2000 },
> >             { Month: "Feb", Revenue: 1000 },
> >             { Month: "Mar", Revenue: 1500 },
> >             { Month: "Apr", Revenue: 1800 },
> >             { Month: "May", Revenue: 2400 }
> >           ], percentage: 33
> >         },
> >         {
> >           title: "cycle 2", perchange: 33,
> >           revenue:[
> >             { Month: "Jan", Revenue: 1000 },
> >             { Month: "Feb", Revenue: 230 },
> >             { Month: "Mar", Revenue: 1500 },
> >             { Month: "Apr", Revenue: 2800 },
> >             { Month: "May", Revenue: 2400 }
> >           ], percentage: 15
> >         }
> >       ]);
> > 
> > When I run the tooTip shows the perchange Number correctly (-32 and
> > 33), but the images don't show so up in the itemRenderer so 
> according
> > to my code currentValue must be "null".  If take out the "else if"
> > statement and the image.source=null then it will show the
> > positiveAmountSymbol because it says it isn't less than 0.
> > 
> > What gives? Thanks in advance.
> > 
> > jason
> >
>


Reply via email to