Solved

Actionscript moving text

Posted on 2008-06-10
9
773 Views
Last Modified: 2013-11-11
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

0
Comment
Question by:thomasmutton
  • 5
  • 4
9 Comments
 
LVL 10

Expert Comment

by:bluefezteam
ID: 21749917

Hello,
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...
0
 

Author Comment

by:thomasmutton
ID: 21749981
where is this mockup?
0
 
LVL 10

Expert Comment

by:bluefezteam
ID: 21750004
hangon the sites rejecting the ZIP file - let me rebuild it
0
 
LVL 10

Accepted Solution

by:
bluefezteam earned 500 total points
ID: 21750021
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
scrollText.jpg
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

Author Comment

by:thomasmutton
ID: 21750060
where abouts do i set the text?
0
 
LVL 10

Expert Comment

by:bluefezteam
ID: 21750115
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
0
 

Author Comment

by:thomasmutton
ID: 21750121
ok will give this a go, thanks.
0
 
LVL 10

Expert Comment

by:bluefezteam
ID: 21750140
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

0
 

Author Closing Comment

by:thomasmutton
ID: 31465677
Fantastic!
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Flash doesn't load in Iphone and Ipad 22 482
Action Script commands 5 234
Where to download Adobe Flash Player 11.9.900.170 5 1,326
File drag and drop 6 131
Here are some practices and techniques that can be adopted into your Flash/Flex application development process. Note: Not all "performance tips" provide an immediately-recognizable benefit.   This article does not include timing validation data,…
I have found that much of my time doing support ends up being a constant repetition of the same steps to different people.  Early on I stated using web pages with Frequently Asked Questions (FAQs) to alleviate most of the burden.  Sometimes this jus…
In this tutorial viewers will learn how to create a basic shape tween animation in Flash including shape hints for smooth animation Open a new document in Flash: Draw a shape: Select another frame (how long you want the tween to be): Right click and…
The goal of the tutorial is to teach the user how to use the auto adjust feature and what the different options do. When your video is not working right you can choose the auto adjust feature to help choose your settings.

919 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now