load different texts in different text fields through one .txt file?
Hi!
If i have different text fields in one flash page like price, description.. is it possible to load different variables like "&price", "&description" from one .txt file?
If you take a look at my example there are 2 text fields:
the first one loads simple text.
the second one is called dayNames and had to show this .txt content:
"&dayNames=Sunday,Monday,Tuesday,Wednesday,Thursda y,
Friday,Saturday"
when i test the movie those contents are shown in the output panel (it was a tutorial) but it's not what i was looking for!
how can i load different texts in different text fields through one .txt file?
rename your text field from dayNames to day_Names because the first one is reserved by AS3, then your last function on layer 3 frame 1 should look like this:
Code:
function loadText(event:Event):void
{
my_txt.text = my_loader.data;
var loader2:URLLoader = URLLoader(event.target);
var variables:URLVariables = new URLVariables(loader2.data);
day_Names.text = (variables.dayNames);
}
I forgot to say, that yes you can load various variables from one .txt file just start the name of each of them with "&" and then the code should look like this
Code:
function loadText(event:Event):void{
my_txt.text = my_loader.data;
var loader2:URLLoader = URLLoader(event.target);
var variables:URLVariables = new URLVariables(loader2.data);
day_Names.text = (variables.dayNames);
test_text.text = (variables.test);
a.text = (variables.abcd);
}
if I had the .txt file with
Code:
&dayNames=safsfds &test=dfsdfds &abcd=sfsdf
then it should show up in those text field correctly.