I found following:
[font=Verdana][color=#800080]http://forums.devarticles.com/archive/t-6645[/color][/font]
[font=Verdana] [/font]
[font=Verdana]It works fine just I do not get the value forwarded from php to the AS. That is: _root.listNum in the line for (i=0; i<_root.listNum; i++) {[/font]
[font=Verdana]Should it not be: nrows ?? or …[/font]
[font=Verdana]From php I can forward no of hits to a Dynamic Text but I can not get the variable as just mentioned. Why is that ??? And this is a problem for not just this script.[/font]
[font=Verdana]If I manally replace: for (i=0; i<_root.listNum; i++) { [/font]
[font=Verdana] with[/font]
[font=Verdana]for (i=0; i<4; i++) {[/font]
[font=Verdana]it gives me a result. I just canøt figure this out.[/font]
[font=Verdana][font=Times New Roman][/font][/font]
[font=Verdana][/font]
[font=Times New Roman]sgorneau [/font]
[font=‘Times New Roman’]This is my problem. I want to populate a combo box in [color=#800080]Flash[/color] with names in a [url=“http://forums.devarticles.com/archive/t-6645”][color=#800080]MySQL[/color] table. I’ve got a [url=“http://forums.devarticles.com/archive/t-6645”][color=#800080]PHP[/color] document that pulls all the names out of a MySQL [url=“http://forums.devarticles.com/archive/t-6645”][color=#800080]database[/color] table. For each row in the table, It pulls the string from ‘lname’ and ‘fname’, and then creates a variable variable to hold the value of $lname.", ".$fname. The script looks like this…
//////////////////////////////////////////////////////////////
$qr = “SELECT * FROM playerInfo ORDER BY lname”;
$re = mysql_query($qr) or die("<br />Could’t run query!");
$nrows = mysql_num_rows($re);
for ($i=0; $i<$nrows; $i++){
$player = “player”.$i;
$lname = mysql_result($re,$i,“lname”);
$fname = mysql_result($re,$i,“fname”);
$$player = $lname.", ".$fname;
$output .= “&player$i=”.$$player;
}
[color=#800080]print[/color] “&listNum=$nrows”.$output;
//////////////////////////////////////////////////////////////
I am sending the variable ‘listNum’ so I can tell Flash how many times to run it’s own loop to populate a combobox.
Now here’s the actionscript…
//////////////////////////////////////////////////////////////
_root.listNum = “”;
loadVariablesNum(“populateListBox.php”, “0”);
popListBoxID = setInterval(popListBox, 50);
function popListBox() {
if (_root.listNum != “”) {
for (i=0; i<_root.listNum; i++) {
_root.userNames.addItem(“player”+i); //<-PROBLEM
}
clearInterval(popListBoxID);
}
}
//////////////////////////////////////////////////////////////[/font]