5 Replies Latest reply on Sep 24, 2009 9:01 AM by alejandrorrr

    List with ItemRenderer goes crazy when scrolling

    alejandrorrr Level 1

      Hello Everyone,

       

                          I have a List with an ItemRenderer defined like this:

       

      <mx:List id="msgList" dataProvider="{ac}" >
      <mx:itemRenderer>
            <mx:Component>
               <ns1:MsgRenderer>
               </ns1:MsgRenderer>
           </mx:Component>   
          </mx:itemRenderer>
      </mx:List>

       

      inside the MsgRender component i have a very simple creationComplete function like this which adds an icon (a yellow star or a black star) depending on a boolean var called star:

      private function pace():void {
                   if (this.data)
                   {
                     if (this.data.star) {
                          this.starIcon.source = "assets/images/ystar.png";
                     }
                     else {
                         this.starIcon.source = "assets/images/bwstar.png";
                     }
                    
                  }
              }

       

      It works fine. BUT when i scroll the list everything gets messed up, the yellow star appears where it should not appear etc,etc,etc. I have checked the datasource "ac" with debugger and everything is in place, it is just the icons in the List that get messed up.

       

       

      Any ideas why this might happen, it is the first time i encounter such a problem!

       

       

      Greetings,

       

       

      Alex