Skip to main content
Participant
April 18, 2006
Answered

Problem passing variable from PHP to Flash

  • April 18, 2006
  • 1 reply
  • 259 views
I'm trying to pass a single variable from PHP to Flash. However, I can't quite get it to work.

In a PHP file named data.php, I'm using:
$query = SELECT SUM(Debt) As Total FROM debtclock";
$result = mysql_query($query);
$debt = mysql_result($result, "Total");
print "debttotal=$debt";

In Flash 8 Actionscript, I'm using:
loadVariables("data.php","0");

As I understand it, this should make the variable debttotal available in Flash.

Can anyone tell me where I'm going wrong?
This topic is closed to new replies. Start a new post to keep the conversation going.
Correct answer blemmo
Try this:
loadVariables("data.php", _level0);
The 2nd parameter specifies the target MC that receives the variables, "0" isn't a valid value for that. With _level0, the variables will end up in the root timeline, so you can access them with _root.debttotal (from _level0) or _level0.debttotal (from another level than _level0).

greets,
blemmo

1 reply

blemmoCorrect answer
Inspiring
April 18, 2006
Try this:
loadVariables("data.php", _level0);
The 2nd parameter specifies the target MC that receives the variables, "0" isn't a valid value for that. With _level0, the variables will end up in the root timeline, so you can access them with _root.debttotal (from _level0) or _level0.debttotal (from another level than _level0).

greets,
blemmo