Groups | Blog | Home
all groups > flash actionscript > october 2004 >

flash actionscript : Loading .txt file (newbie)



someone
10/5/2004 7:59:27 PM
I am doing a tutorial from flashkit on loading text from a .txt file.
The code for loading it is placed in the only frame of the only layer.
A dynamic text field is placed on the screen with an instance name
of "text". I then placed the following code in the frame.
stop()
loadVariablesNum("news.txt", 0);
The text file has the following in it.
&text=I am updating the news using text!
&textloaded=OK
Both files are save to the same folder on the server. What did I do
wrong?
someone
--
someone
10/5/2004 10:02:20 PM
I fixed something that I thought would fix it and it didn't. I
variable inf the swf was called "news" and the .txt was &text. I
fixed the .fla to text and it still doesn't work.
10/5/2004 7:59:27 PM
[quoted text, click to view]
--
kglad
10/6/2004 4:30:30 AM
you confusing a variable name (text=I am...) and an instance name and you're
failing to check that loading has completed before doing anything with your
loaded variable(s). try:

_root.createEmptyMovieClip("dataHolder");
dataHolder.loadVariables("news.txt");
dataHolder.onData=function(){
yourTextFieldInstanceName.text=this.textVar; //where &textVar=I am updating
the news...
}
AddThis Social Bookmark Button