2 Replies Latest reply on Oct 23, 2007 6:59 PM by Joe Haswell

    Applying an add event in sequence

    Joe Haswell
      Hi everyone.

      I'm just coming to Flex and Actionscript from Java, and I can't figure out how to apply an effect to a set of buttons as they're loaded.

      For example, I have these buttons:




      <mx:Button label="Collection" width="126" styleName="button" themeColor="#B5B5B6" id="col" x="10" y="149"/>
      <mx:Button label="About" width="126" styleName="button" themeColor="#B5B5B6" id="about" x="10" y="182"/>
      <mx:Button label="Campaign" width="126" styleName="button" themeColor="#B5B5B6" id="camp" x="10" y="215"/>
      <mx:Button label="Event" width="126" styleName="button" themeColor="#B5B5B6" id="event" x="10" y="248"/>
      <mx:Button label="Shop" width="126" styleName="button" themeColor="#B5B5B6" id="shop" x="10" y="281"/>
      <mx:Button label="Contact" width="126" styleName="button" themeColor="#B5B5B6" id="contact" x="10" y="314"/>



      and this effect:

      <mx:Sequence id="fade">
      <mx:Fade alphaFrom="0.0" alphaTo="1.0" duration="2000" />
      <mx:Pause duration="500" />
      </mx:Sequence>



      I'd like the first button to fade in, and when that one's done, I'd like the second to fade in and so on, but I'm quite new to Flex and I don't really know what to look for. I've been going through a lot of tutorials, but haven't been able to find a solution.

      I'm sorry if this is a repeat question, I did try Google first with no success.

      Thanks!

      Joe
        • 1. Re: Applying an add event in sequence
          atta707 Level 2
          buttons, like most display objects, have showEffect property that you set to your desired effect but that won't achieve what you're looking for.

          you can do what you're looking for in your app/component creationComplete event. Initially all of your buttons would be hidden. You would start off a Timer and in its tick event you'd play the effect for button 1 then button 2 and so on.

          So look for Timer class in the help and its timer event.

          as for the effects, you can simply say in your

          var fader:Fade = new Fade();
          fader.duration = 2000;
          fader.play(button1);

          Hope this helps.

          ATTA
          • 2. Re: Applying an add event in sequence
            Joe Haswell Level 1
            Hey thanks! That helped a lot!

            Joe