PDA

View Full Version : loadVars and php


duda
03-27-2004, 04:08 PM
hello
i have a little big problem with loading variables into flash.
i have tried with loadVars class and with MovieClip.loadVariables
but it doesn't work!
here is the actionscript:

locData= new LoadVars();
locData.load("plan.php");
nr=locData.nr;

but nr remaind undefined
the php works because i've tested it.
the code id:

<?php
mysql_connect("localhost","user","pass");
mysql_select_db("db");
$qr = @mysql_query("SELECT * FROM table");
$nrows = mysql_num_rows($qr);
$rString = "nr=".$nrows;
for ($i=0; $i < $nrows; $i++) {
$row = mysql_fetch_array($qr);
$rString .= "&name".$i."=".$row['name'];
$rString .= "&img".$i."=".$row['img'];
$rString .= "&text".$i."=".$row['text'];
}
echo $rString;
?>

so what happens? :confused:
10x a lot!
:D

splict
03-27-2004, 06:01 PM
you are trying to assign nr before your file is loaded. check out LoadVars.onLoad()

-splict

duda
03-29-2004, 08:23 AM
i have added

locData.onLoad=function(){
number=locData.nr;
}

but it doesn't work!
i've tried this too:

locData.onLoad=function(success){
number=locData.nr;
}

but it doesn't work either!
why,oh why?

:confused:

stealthelephant
03-29-2004, 06:20 PM
locData.onLoad=function(success){
if(success)
number=this.nr;
else trace("no values");
}

duda
04-01-2004, 10:11 AM
10x
i've figured it out!