PDA

View Full Version : FMX-external variable syntax



borispc
September 10th, 2003, 03:52 PM
Hi again!
I have a LoadVars object called loadText in which an external variable is loaded from a text file.
Now, the whole thing works, I just want to create a template to optimize the system, so here is what I need:
The external variable (in an external text file) is called page1.
I am assigning that external variable to a local variable (at this point the external text has already been loaded in loadText, of course):

my_str=loadText.page1;

Now this works but I want to be able to have that page 1 up here as a variable:
(something like this):
my_str=loadText._global.page
where _global.page could have different values page1, page2, etc.
Now, I know this syntax is not correct because it just doesn't work...so how do I do this????
thanks!!!:toad:

borispc
September 10th, 2003, 03:57 PM
I guess that a quick way to solve it is by doing this:
_global.page=loadText.page1;
my_str=_global.page;

**this works**

borispc
September 10th, 2003, 05:00 PM
that didn't actually allow me to have the control I needed...
but I ended figuring it out myself..
here's the proper syntax:
my_str=loadText["page"+_global.pageNum];
this allows me to reuse the code just by changing _global.pageNum to 1,2,3, whatever to determine what variable to get from the text file(which are page1,page2,etc).
Of course I went a step further and gave the textfile name another variable to be able to change that too. :P