Actionscript moving text

Hello experts.

I have a script that creates dynamic text but I want it to continuously move from right to left (like you see on the news shows like CNN).

How would I do this?

My current code outputs text horizontally.
var Records = ActionSpeak.Recordset.Records;
var iSpaceBetweenTextFields :Number = 10;
for (i=0; i < Records.length; i++) 
        // The textfields width is now set to 10 to make sure that the autoSize-property set's the size according to the actual width of the text
        var txtArea = this.createTextField("textbox" + i, i, 5, 100, 10, 20);
        // The position is based on the previous textbox, so we need to have a variable to access it - txtPreviousArea.
        var txtPreviousArea = this["textbox" + (i-1)];
        // The autoSize-property is important to make sure the text-field resize according to the actual text
        txtArea.autoSize = true;
        txtArea.selectable = false;
        txtArea.text = Records[i]["UserFirstname"];
        // The x-position is based on the previous textfield and the spacebetween-variable
        txtArea._x = txtPreviousArea._x + txtPreviousArea._width + iSpaceBetweenTextFields;

Open in new window

Who is Participating?

Improve company productivity with a Business Account.Sign Up

bluefezteamConnect With a Mentor Commented:
Annoying - they wont let flash files (FLA) be uploaded, so I dropped it in a zip file and still rejected.

have renamed the extension to JPG so rename it back to FLA

Should be some code in there to handle the scrolling

I've included a quick mockup of a horizontal scroller.

from this you can name the scroller instance - eg mcText then target mcText._txt.text = YOUR CONTENT

If you made the textfield a HTML textfield then you could concatanate your text with a link. <a href="LINK.html">latest item</a> to send people to more information...
thomasmuttonAuthor Commented:
where is this mockup?
Easily Design & Build Your Next Website

Squarespace’s all-in-one platform gives you everything you need to express yourself creatively online, whether it is with a domain, website, or online store. Get started with your free trial today, and when ready, take 10% off your first purchase with offer code 'EXPERTS'.

hangon the sites rejecting the ZIP file - let me rebuild it
thomasmuttonAuthor Commented:
where abouts do i set the text?
From my first comment, I said if you target...

mcText._txt.text = "YOUR CONTENT";

you can inject your new text into the textfield from the main root of the document and the function for the scroller will shift all the text

You will need to develop the function a bit so it can expand the textfield but this is the principle of scrolling text
thomasmuttonAuthor Commented:
ok will give this a go, thanks.
inject your text before the function defines the textbox width (as the amount of text will change the box width)
mcText._txt.text="you can inject your new text into the textfield from the main root of the document and the function for the scroller will shift all the text";
var resetPos:Number = (mcText._txt._x * -1) + 2; //define where to start the mcText text when scrolling
var endOfText= mcText._txt._x - (mcText._txt.textWidth + 5);  //right edge of text with a 5px buffer

Open in new window

thomasmuttonAuthor Commented:
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.