As the title of this post says, I’m trying to have the swf name in the loadmovie line to be generated from a txt file…
The text file (named “swfvariable.txt”) goes as such:
variable=swfpick
And the script goes like this:
loadVarsText = new loadVars();
loadVarsText.load("swfvariable.txt");
name = this.variable;
picked = ("load_"+name+".swf");
loadMovie(picked, "_root.target");
When I create a dynamic text field with the var name “name” - the variable “swfpick” shows up in it. But no matter what, so far, all I’m getting is the movie trying to load in “load_.swf”
I`m not sure variable is such a good name for a variable but how you have written this, flash is looking for a vaiable on the timeline. Put it like this to see if its anybetter
loadVarsText = new loadVars();
loadVarsText.onLoad=function(){
name = this.variable;
picked = (“load_”+name+“.swf”);
loadMovie(picked, “_root.target”);
}
loadVarsText.load(“swfvariable.txt”);
I used ‘variable’ in my post to make it clear and non-specific. Also, outputting the variable to a text box was just to see if I was getting it from the txt file.
This totally worked. Thanks so much!
:bu:
by the way, in my txt file, i had the variable in quotes, as I had left it from one bout of troubleshooting. The script you gave me returned the variable in quotes, which of course did not work, so I deleted the quotes and then it worked perfect. Thanks again.