PDA

View Full Version : How to load text from a *.txt?


Ian Jones
02-20-2003, 02:28 PM
Hi,

I'm trying to get a Dynamic text field to load text from a *.txt file, so that I only have to upload a revised *.txt file to my server when I want to change the text in my FlashMX website. Obviously this means I don't have to actually go into flash and edit the text, publish then upload.

How do I do it?

Virusescu
02-20-2003, 03:14 PM
loadVariablesNum("file.txt",0);

In your file you should have
varname = the text you want to display

And in your movie you simply display the variable varname into a dinamic text field.

Question:
Does anybody know how to define multiple variables into a txt file?

Caman0
02-20-2003, 03:15 PM
http://www.flashkit.com/tutorials/Actionscripting/Basic/Reading_-Brett_Ta-139/index.php

and there you go :)

Caman0
02-20-2003, 03:16 PM
...both of you :)

knebbes
02-20-2003, 04:08 PM
its a good idea to make a variable "&loaded=1" at the end of the textfile, so in flash you can check if the text has loaded and play a loading animation or something like that while it hasn't

Ian Jones
02-20-2003, 10:57 PM
Thank you guys... I'll give it a go.

Ian Jones
02-21-2003, 12:28 AM
I can't get it to work. I have tried absolutely everything! It won't farking work!

Ian Jones
02-21-2003, 03:05 AM
ok, finally I managed to get it to work in a completely new blank file.

I also got it to get a little further in my website, problem is that instead of loading the variable's content into the dynamic text box it actually opens a new explorer window and opens the text file completely as it is written. WTF!???

&content=dog
cat
mouse

Ian Jones
02-21-2003, 03:11 AM
some more info... I got it to at least launch the text file in explorer because I figure the problem is maybe because of levels (not that I have used any! thats why its so weird)

loadVariablesNum("bbcontent.txt",_root);

normally you replace the "_root" with "0" but at least _root did something...!

Ian Jones
02-21-2003, 03:22 AM
AHA! I figured out something... :bounce:

The layer on which I am placing the dynamic text box is masked, when I remove the mask it works. I have checked if other content can be displayed underneath this mask (b&w / vice versa).

Static text works whilst under a mask, but dynamic text doesn't!

Are there any solutions or little tricks to get it to work under the mask?

Caman0
02-21-2003, 02:35 PM
first thing that comes to me mind...dunno if it will work

put the dynamic text in a movieclip and mask the movieclip?

knebbes
02-21-2003, 05:41 PM
embed the font of your dynamic textfield by clicking on the "embed fonts" buttons in the text options

CGTalk Moderation
01-14-2006, 11:00 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.