6 Replies Latest reply on Feb 5, 2008 11:23 AM by peterent

    ticker tape

      Hi guys,

      im new to flex, but have been using flash for some time now..

      I need to make a ticker tape using flex. I have been searching for days to see some examples and i have found 2 or 3 topics in this forum which cover it, but they dont have any examples..so im totally lost..

      basically this is what i need:

      1. load data from an xml feed (ill use the HTTPService with flex, and load the data into an array..)
      2. i need the ticker to show the data i got from the xml, it has to scroll (up, down, left, right..i dont mind!!!)
      3. it has to pause for a couple of seconds when its showing the text, before it moves to reveal the next bunch of text...

      I could probably do this in flash, but i need to use flex to get the xml feed data. In the posts i've read it seems like this is all possible, but i just cant seem to find any examples.

      I would REALLY appreciate if someone could either point me to the right direction or show me some examples please.

      Thanks in advance guys
        • 1. Re: ticker tape
          peterent Level 2
          Break this task into its parts: request the data, receive the data, display the data, pause the data, move the data.

          You are using HTTPService to get the data. Keep in mind that it is asynchronous, so use a result event handler to capture the XML as it is received.

          For the display, you can use a Canvas (turn off its scrolling policy) and a Label within it. You can move the Label with the Move effect. When you need to pause it, stop the Move effect and use the Timer class to sleep for a bit, then create a new Move effect and let it go.

          You can calculate how far to move the label and when the Move effect has completed, an event will fire. You can then start the Move effect again (if you give the Move effect an xFrom and an xTo the Move effect will first locate the Label at the xFrom position so you don't have to do that yourself).
          • 2. Re: ticker tape
            capuman Level 1
            Thanks for the tips, thats exactly what i ended up doing.

            If anyone is interested in seeing the code let me know and ill post it.

            • 3. Re: ticker tape
              GeorgeWS Level 1
              Can I see your code?

              • 4. Re: ticker tape
                peterent Level 2
                I posted my code on my blog:


                The source is available. Just an alternate way to do it.
                • 5. Re: ticker tape
                  Hi guys!

                  peterent, it's quite clear how to create a ticket tape with moving text.
                  I'm a total newbie in Flex, so I wonder - how can I implement table (DataGrid?) moving, based on your script? I need only "up-bottom" and "bottom-up" moving directions.

                  For example, I have an collection of XML objects, describing product prices: product name, price, and an image "up"/"down" showing the price change for the given time period. When the first row "drives off" the screen, it should appear as the last one.

                  Say, there are 10 products. As I see the solution now - I can just change Labels in your code to DataGrid objects and update the moving logic, and it will work. Am I right?
                  • 6. Re: ticker tape
                    peterent Level 2
                    You should just be able to replace the Text (or Label, I forget which I used) with a DataGrid - or any Flex component. Just remember that there is more graphics so it might appear to be shaky when it moves.