hello guys, im just to buil my data driven application im still newbie.. can anyone help with get var from php code to flash.. Im using LoadVars here is my code..

var lvFile:LoadVars = new LoadVars();

lvFile.load = function(bSuccess:Boolean){
if (bSuccess){
trace(lvFile.name1);
trace("loaded");
}
else{
trace("not loaded!!!!");
}
}
lvFile.load("http://localhost/web/final_website/Flash/test.php");

and here is my php code..

<?php
$name1 = "Its me!";
echo $name1;
?>

Im having undefined in my output panel in flash.. Can anyone help how to do it right? thanks guys for the help...

    Hi,

    To load data using LoadVars in Flash you need to pass variable name and data both through PHP..

    to explain what I mean your PHP code will be

    <?php
    $name1 = "Its me!";
    echo "name=".$name1;
    ?>
    

    that way if you have more than one values to pass you can pass them as

    <?php
    $name1 = "Its me!";
    $secondvar="test";
    echo "name=".$name1."&secondvar=".$secondvar;
    ?>
    

    Hope this will help you.

      when i tested youre php code i got error in my php..

      Parse error: syntax error, unexpected ';' in C:\Program_PHP\wamp\wamp\www\web\final_website\Flash\test.php on line 3

      it is still undefined i didn't retrieve the value of php code..

        Write a Reply...