5 Replies Latest reply on Jul 6, 2011 7:36 AM by kokorito

    How to set Fade effect to itemrenderer correctly

    yancaoshi Level 1

      Hi all,

       

      I make use of spark.layouts.TileLayout to display lists. And want to show the image in item with Fade effect.

      Since it's a actionscript class and the image is a BitmapImage, I did in this way.

       

      In ItemRenderer, I defined

           private var iconFade:Fade;
      

       

      After the BitmapImage is created, I initialize it

           iconFade = new Fade();
           iconFade.alphaFrom = 0.0;
           iconFade.alphaTo = 1.0;
           iconFade.target = iconDisplay;//iconDisplay is the BitmapImamge
           iconDisplay.addEventListener(FlexEvent.READY, handleIconFadeIn);
      

      The event handler is simple

           private function handleIconFadeIn(e:Event):void
           {
                iconFade.play();
           }
      

       

      It works as expected for the beginning items. I have 6 items displayed in one screen, and it simply repeats about 12 images if I scroll down. Sometimes, it shows blank image and appears when I singe click on it.

       

      It's really weird to me and I don't know what else to do. I tried some other events like Event.COMPLETE, Event.ACTIVATE, but it gets worse.

       

      Thanks and regards,

      Felix