This content has been marked as final. Show 7 replies
you need to write pairs of variableName= variableValue in your text file; not just "hello", as you stated.
AN example from the manual:
Also, you wrote "holder.loadVaribles[...]", which is wrong: you just need to write at the txt file "holder=hello"
and the action loadVariables("textFile.txt"), which will load the variable holder into the _root of the movie.
the dynamic text will then update properly since you identified it with the variable holder.
Ok I made the following two changes like you said:
1. In the text file I wrote "holder=hello"
2. In fla file I change the line holder.loadVariables("file.txt") to loadVariables("file.txt")
But still it doesn't print anything. I think I am missing something because you said it will load the variable in _root of the movie. How do I access _root?
I looked again in the Manual under loadVariables. It seems you need to load the variables into a movie clip.
Try creating an empty MC on the stage, give it an instance name and load the varibles into it:
then, you'll have variables_mc.holder (= hello)
and you could assign it as holder.txt = variables_mc.holder;
I remember there was a simpler way, because now you'll need to monitor when the varibles are loaded etc.
See the manual for example.
The following code got me out of a bind. It is mostly from the Flash help files, however, I also included some code that gets rid of any extra cariage returns and line breaks.
Many thanks Tal_CS it worked! :)
iceman haven't tried your code yet, because I don't know where to put it hehehe, but I assume it needs to be written in the same way as loadVariables(...), thanks!... will try it later
No problem ali. The code I showed you would go in the actions layer on the same frame as the dynamic text field that holds the "file.txt".