|
-
Senior Member
[MX04] Unable to get LoadVars to use array reference to loaded variable
Hi,
I would like to display some text that I have loaded into a movie through the “”LoadVars” object. I am able to do this if I “hardwire” the name of the variable to be picked up on in the loaded .txt file, but not if I use a reference to the variable by looping through an array holding the variable names used in all the files to be loaded in.
So in other words this will work:
Code:
_root.past_txt.text = _root.varLoader_array[0].past;
But this wont:
Code:
variableName_array=["past", "present", "future"];
_root.past_txt.text = _root.varLoader_array[0].variableName_array[0];
I think the problem might be that Flash sees the “variableName_array[0]” part as a string & not a variable, I really don’t know, but I would be grateful if anyone can help me out on this.
Many thanks.
Last edited by pup100; 12-06-2008 at 05:36 PM.
You will know everything when you know you never will.
-
Code:
_root.past_txt.text = _root.varLoader_array[0][variableName_array[0]];
-
Senior Member
Many thanks for that dawsonK.
I am already in your debt, but any chance of few words just to explain how that worked? I know you can use _root[someclip[g]] to locate or asign a variable dynamically, but did'nt know that worked for arrays.
Not to worry if you don't get the chance, it worked & thats the main thing!
You will know everything when you know you never will.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|