Flash Question: loadVariables
- Started
- Last post
- 9 Responses
- noneck0
Yeah, I was thinking of doing that,; but after more diggiing around, I found out that you use the split function to make it go.
text file:
myVar=one,two,threeAS:
loadVariables("textfile.txt", "");
myVar = myVar.split(",");
- noneck0
Carp.
Okay, my split() function ain't workin. Why?
myVar = "one,two,three,four";
myVar = myVar.split(",");
trace(myVar[1]);
// Yeilds "undefined" WTF?Help?
- unfittoprint0
you have a stop(); at the end, right? If not it continuosly make myVar="one,two,three,four" without turning it as an array....
- noneck0
No stop();
It moves on to other frames.
- majman0
maybe put the trace command a few frames further on the timeline. sometimes it takes a sec for the loadVar to load.
- unfittoprint0
check your email.
- noneck0
Thanks unfittoprint (and others)for your help.
I was having two problems:
1. I am stupid.
2. loadvariables doesn't get executed until everything else on the frame gets executed.I was trying to work with the loaded vars right after the loadvariables function.
If you loadVariables on frame 1, you can't work with them until frame 2.
- unfittoprint0
you're welcome.
The thing with loadvars is that allows you to do your stuff in just one frame (as long you create a nice onload function).
- unfittoprint0
You could separate the individual parts of the array, load them using the new LoadVars object, and then use a for loop and remake the array.