all groups > flash actionscript > february 2004 >
You're in the

flash actionscript

group:

Adding text to dynamic text field


Adding text to dynamic text field Volume4
2/2/2004 9:31:08 PM
flash actionscript:
When loading text from an external text file into a dynamic text field using the following Action Script:

Features_lv = new LoadVars();
Features_lv.onLoad = onText;
Features_lv.load("about_us.txt");
function onText() {
aboutus_txt.text = Features_lv;
}

The text does load successfully into the field but all spaces are displayed as '%20', does anyone have an idea why this is happening?

Thanks
Schalk

Re: Adding text to dynamic text field eonyron
2/3/2004 6:39:27 AM
Interesting issue!

I don't understand the reason you declare the function to do all this but I figure you have your reasons. In doing that you are pulling the text without the "quotes" that read back as spaces instead of %20.

Mabey declare variables within the text like:
line1=this and that&line2=this and that.

I may be off track here, I would like to see this problem solved. I hope this helps...

Good Luck!

Re: Adding text to dynamic text field Volume4
2/3/2004 8:53:48 AM
Thanks for your input, I resolved the issue. It was really just an issue of me not completely understanding the process of reading information into Flash that has been loaded using loadVars().

I have changed the code now to the following:
var content_lv = new LoadVars();
content_lv.onLoad = setContent;
content_lv.load("about_us.txt");

and set the content as follows:
function setContent() {
aboutus_txt.text = content_lv.aboutus;
// The only real change being calling content_lv.aboutus instead of just content_lv
// .aboutus being the name from which you want to extract the value in the external text file's
// name=value pairs.
}

Hope this can help someone else out and save them some time.
Schalk

AddThis Social Bookmark Button