1 Reply Latest reply on Apr 24, 2010 12:15 PM by gengwang

    Custom itemRenderer effect and itemIndex (gumbo)

    gengwang

      Hi,

       

      I am trying to creating an effect which fades in one item after another in my itemRenderer (wrapped by DataGroup). In order to play the effect consecutively on each item, I set the startDelay of the effect on each item based on its itemIndex like so:

       

      <s:Fade id="fadeIn"
                      alphaFrom="0"
                      alphaTo="1"
                      startDelay="{itemIndex*200}"
                      duration="1000"/>

       

      And I use the effect on it like so:

       

      <s:ItemRenderer xmlns:fx="http://ns.adobe.com/mxml/2009"
                      xmlns:s="library://ns.adobe.com/flex/spark"
                      xmlns:mx="library://ns.adobe.com/flex/mx"
                      autoDrawBackground="true"
                      addedEffect="{fadeIn}"
                      alpha="0">

       

      But the effect plays on all items all at once when the datagroup shows up, as opposed to fade in one item after another as I expected. Or in order words, the startDelay/itemIndex don't seem to have effect.

       

      I looked into the Flex 4 doc and I am not able to locate the place where I should look for guidelines as to how to create effect on custom ItemRenderer. Thanks for help and have a good weekend!

       

      Geng

        • 1. Re: Custom itemRenderer effect and itemIndex (gumbo)
          gengwang Level 1

          Ok. So if I play the effect on creationComplete like this, it does play as expected the first time the dataGroup is created.

           

          <s:ItemRenderer xmlns:fx="http://ns.adobe.com/mxml/2009"
                          xmlns:s="library://ns.adobe.com/flex/spark"
                          xmlns:mx="library://ns.adobe.com/flex/mx"
                          autoDrawBackground="true"
                          creationComplete="fadeIn.play([this]);"
                          alpha="0">

           

          But still have no idea of how to get it work on addedEffect. I need the effect to play each time its dataProvider has changed or each time the screen shows up that contains this datagroup.

           

          Is addedEffect triggered before creationComplete???

           

          Thanks.