13 Replies Latest reply on Dec 2, 2011 6:29 AM by kglad

    Flash and PHP


      Hi, let's say I have a dynamic text field (variable name is "txt") that I wanted to read from a PHP file and output the contents from there.


      My AS code is:


      var myPHP:LoadVars = new LoadVars();


      myPHP.load("variables.php"); //my php file


      myPHP.onLoad = function(success:Boolean){

                if (success) {

                          txt= myPHP.msg; //displaying contents from php




      PHP code in variables.php:




      // Define Variables


      $msg = ($_GET['msg']);


      // Send it to Flash

      echo "msg=$msg";




      If I key in the url as follows and send something to the msg:




      It will echo "msg=Hello", but the text field inside flash turns out to be empty, not undefined or anything. If however I hardcode the php file with:


      $msg = "Hello";


      It will still echo "msg=Hello" but the flash file will display the text accordingly.


      Can anyone tell me why? Thanks!