PDA

View Full Version : Dynamic text scrolling in MX 2004


tool712
04-27-2005, 02:36 AM
For some stupid reason, I can't figure out how to make dynamic text scroll. I've looked in and out of these forums, but nothing here was answered for MX 2004 that I saw. If anyone can help, it'd be greatly appreciated.

I included the .fla so you can see what code I used where and whatnot.

Thanks.

textScroller (http://tool712.com/dz/news.fla)

Flash Gordon
04-27-2005, 03:45 AM
link passord protected :rolleyes:
Just drag the scroll bar to the text box or use the textArea component

hiredassassin
05-26-2005, 01:54 AM
link passord protected :rolleyes:
Just drag the scroll bar to the text box or use the textArea component

HIya..

im in the same boat as tool712 - im trying to add a scrollbar to some dynamically loaded text, ive searched and searched and i just cant find a simple (for a layman like me) solution...

there is no scrollbar component in 2004...

can anyone give a quick step by step on how to use the scrollpane to do it??

PreCoder
05-30-2005, 04:56 PM
Hi there,
Hopefully this helps. Let us know how you go, or if this was any help at all.

As you are only loading in text you might as well use the textArea Component its just as easy to use. Make sure you give the component an instance name in the case below I have called it myTextArea for convience. As you can already get the text onscreen I assume that you already know that the text file needs to be preceed by a variable name, but I'll tell you just in case you don't know e.g. say your text file in notepad looked like this:

Little Miss Muffet sat on her bum eat lots of food until she became so fat she couldn't walk anymore.

You would need to give it a variable for flash to look for, in the example below I have called the variable "fileText". So if you where to open the above file in notepad it should look like this:

fileText=Little Miss Muffet sat on her bum eat lots of food until she became so fat she couldn't walk anymore.

I hope I haven't confused you, if I have sorry :rolleyes:

Also you will notice when you read the code below that I have myTextArea.wordWrap set to true, that's so you don't have one continuous line of text.

I think that explains it so here it is...

Here is the code that you would place on the main timeline
loadText = new LoadVars();
//loading text field in
loadText.load("myDynamicTextField.txt");
loadText.onLoad = function(success) {
if (success) {
myTextArea.wordWrap = true;
myTextArea.text = this.fileText;
} else {
myTextArea.text = "Failed to load Text file, please make sure file is present and try again...";
}
}