4 Replies Latest reply on Apr 7, 2011 2:16 AM by tiegur1

    How to build a rotating banner with Flex

    2009 Matt Level 1

      Is there any built-in Flex classes that support it?

        • 1. Re: How to build a rotating banner with Flex
          Gregory Lafrance Level 6

          I think you need to roll your own. Maybe someone can suggest a sample component.

          • 2. Re: How to build a rotating banner with Flex
            2009 Matt Level 1

            My banner just contains text messages moving from right to left repeatly. It seems no easy solutions in Flex, but there is a way in HTML.

            I hope to find a solution in ActionScript or Flex.

            • 3. Re: How to build a rotating banner with Flex
              rtalton Level 4

              You can make the text appear to crawl across the screen by using the Move effect and moving the text component. Of course, you'll have to figure out how to re-start the animation after the text leaves the screen, but that shouldn't be too hard.

              For an advanced example of this, check out my news ticker here:

              https://www.anaheimjobs.com/

               

              It's using images and text inside an HBox, fade in/out fx, text from an external XML file, and a bunch of other stuff, but you'll get the idea.

              • 4. Re: How to build a rotating banner with Flex
                tiegur1

                try this for example code:

                if you're calling it from as soon as the site loads, just add the


                creationComplete="initApp()"


                inside your application brackets

                 

                AS:
                private function initApp():void
                            {
                                onload.end();
                                onload.play();   
                                wipeban.end();
                                wipeban.play();   
                            }

                 

                //Then code this to <fx:Declarations>:

                 

                 

                    <s:Sequence id="wipeban" repeatCount="0">
                            <s:Parallel>
                                <mx:Pause duration="5000"/>
                                <s:Move id="bannermoveout" xFrom="0" xTo="1500" duration="1000"   target="{banner}"/>
                                <s:Fade alphaFrom="1" alphaTo="0" duration="600" target="{banner}"/>
                            </s:Parallel>
                            <s:Parallel>
                                <s:Move id="bannermovein" xFrom="-1500" xTo="0" duration="1000"   target="{banner}"/>
                                <s:Fade alphaFrom="0" alphaTo="1" duration="1000" target="{banner}"/>
                                <mx:Pause duration="5000"/>
                            </s:Parallel>
                        </s:Sequence>

                 

                This would go in a contentnav for example

                 

                 

                <s:BorderContainer id="banbox" width="592" height="227" top="180" x="494">
                                     <mx:Image id="banner" source="{ban}" alpha="1"  width="594" height="189" smoothBitmapContent="true" scaleContent="true" autoLoad="true"/>
                              </s:BorderContainer>

                 

                Hope this helps