0 Replies Latest reply on Apr 1, 2010 7:59 AM by nikos101

    Trying to display ticking rates

    nikos101 Level 2

      I'm trying to display ticking rates and at the moment I just want to update one of the labels "ask". But the code isn't working, the whole line goes the color except the one that displays the currency?

       

      Any clues friends?


      <mx:List height="100%" width="400" dataProvider="{curData}">
              <mx:dataChange>
                  <![CDATA[
                  ]]>
              </mx:dataChange>
              <mx:itemRenderer>
                  <mx:Component>
                      <mx:HBox verticalAlign="middle" width="100%">
                          <mx:Script>
                              <![CDATA[
                                 
                                   private var oldData:Number;
                                  
                                   override protected function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void
                                   {
                                   if (oldData)
                                   {
                                       super.updateDisplayList(unscaledWidth, unscaledHeight);
                                       var g:Graphics=ask.graphics;
                                       g.clear();
                                       if (oldData <  data.Ask)
                                       {
                                           //unmatched
                                           g.beginFill(0x00ff00);
                                           g.drawRect(0, 0, unscaledWidth, unscaledHeight);
                                           g.endFill();
                                       }
                                       else if (oldData >  data.Ask)
                                       {
                                           //matched
                                           g.beginFill(0xff0000);
                                           g.drawRect(0, 0, unscaledWidth, unscaledHeight);
                                           g.endFill();
                                       }else{
                                            g.beginFill(0xffffff);
                                           g.drawRect(0, 0, unscaledWidth, unscaledHeight);
                                           g.endFill();
                                       }
                                   }
                                   if(data){
                                      
                                   oldData = data.Ask;
                                  
                                   }
                                   }
                                 
                              ]]>
                          </mx:Script>
                          <mx:Label text="{data.Currency}" width="20%">

       

                          </mx:Label>

       

                          <mx:Label id="ask" text="{data.Ask}" width="20%">

       

                             
                          </mx:Label>
                          <mx:Label text="{data.Bid}" width="20%">

       

                          </mx:Label>
                          <mx:Label text="{data.DailyMax}" width="20%">

       

                          </mx:Label>
                          <mx:Label text="{data.DailyMin}" width="20%">

       

                          </mx:Label>

       

                      </mx:HBox>
                  </mx:Component>
              </mx:itemRenderer>

       

          </mx:List>