PDA

View Full Version : easy php question...


scottkenyon
06-14-2005, 01:21 AM
loadVariablesNum ("/schedule/gigs.txt",0);

will this AS work to load variables from a php file instead of a txt file, like say,

loadVariablesNum ("/schedule/index.php",0);

?

CyanBlue
06-14-2005, 02:05 AM
Howdy and Welcome... :)

I think that'll work as long as your PHP file spits out variable=value pair...
I'd recommend using LoadVars() object instead of the loadVariablesNum() function if you are using for FMX and above... ;)

mmm..pi..3.14..
06-14-2005, 02:07 AM
yes, but there is a difference.

In text files you just need to place a "&VariableName=" in front of the text for flash to load it, but because it's PHP, you need to "broadcast" the data so flash can pick up on it. You do that by "echoing" the data, like so:


echo("&VariableName=blablablabla&");


Note that I put an extra "&" at the end. It's not necessary, but I myself have run into issues where flash won't quit reading the data, so it reads everything in the php file beginning at the first "&", including the "?>" at the end. Like I said it's not necessary, but I think it's a good habit to get used to ;)

You might also want to use LoadVars instead of loadVariablesNum, it's just alot more reliable :)

Eric