What tutorial is this from? It's wrong. The second paramter in the loadVariables is not the movie to load them into it's the method either POST or GET
So that should read loadVariables("text.txt","GET")
Here's an example from the livedocs at Macromedia
code:
this.createEmptyMovieClip("target_mc", this.getNextHighestDepth());
target_mc.loadVariables("params.txt");
function checkParamsLoaded() {
if (target_mc.done == undefined) {
trace("not yet.");
} else {
trace("finished loading. killing interval.");
trace("-------------");
for (i in target_mc) {
trace(i+": "+target_mc[i]);
}
trace("-------------");
clearInterval(param_interval);
}
}
var param_interval = setInterval(checkParamsLoaded, 100);
You can't use the trace lines but change them to dispay in a editbox with txt1.text= instead...
BUT BETTER YET
Use the loadVars that is available since flash player 6 it offers Much better functionality
You can use the LoadVars class to obtain verification of successful data loading and to monitor download progress. The LoadVars class is an alternative to the loadVariables() function for transferring variables between a Flash application and a server.
The LoadVars class lets you send all the variables in an object to a specified URL and to load all the variables at a specified URL into an object. It also lets you send specific variables, rather than all variables, which can make your application more efficient. You can use the LoadVars.onLoad handler to ensure that your application runs when data is loaded, and not before.
The LoadVars class works much like the XML class; it uses the load(), send(), and sendAndLoad() methods to communicate with a server. The main difference between the LoadVars class and the XML class is that LoadVars transfers ActionScript name and value pairs, rather than an XML Document Object Model (DOM) tree stored in the XML object. The LoadVars class follows the same security restrictions as the XML class.
Availability: ActionScript 1.0; Flash Player 6
Here's the link to the liveDocs for LoadVars. I reccomend you look it over as with loadVars you can load things like complete text files and as I just learned in another thread you could load a CSV file with this. http://livedocs.macromedia.com/flash...=00002323.html
You are initiating the loadVariables in a frame where the text field does not exist. I placed it in frame 1 also. I also made it's variable name "mytext". This is to match the variable name in the actual text file which I changed to:
Code:
&mytext=This text is a variable that will appear in my new Kool Moves Movie.&
Also, try to avoid using the word "text" as a variable name and treat it as a reserved word.
Your using loadVariables is fine and plenty of people still use it. The actionscript on frame one is now:
**Flashplayer (depending on the version) only supports certain tags. Visit the Macromedia website for a list of tags allowed in the different versions**
Open the properties panel for that dynamic textfield and change "Has A Border" to "No" and "Has HTML" to "Yes":
Then change your textfile to this:
Code:
&mytext=<a href="http://www.koolmoves.com" target="_blank"><u>This text is a variable that will appear in my new Kool Moves Movie.</u></a>&
Last edited by Chris_Seahorn; 04-08-2006 at 12:19 PM.