8 Replies Latest reply on Sep 24, 2011 11:29 AM by Ned Murphy

    cannot pass variables from PHP to actionscript 3.0


      I am using CS3 and I write the following code as to pass variable to flash from PHP






      var myLoader:URLLoader = new URLLoader();

      myLoader.dataFormat = URLLoaderDataFormat.TEXT;

      var myRequest:URLRequest=new URLRequest("http://localhost/moodle/value.php");





      var myValue: String;

      function onCompleteHandler(e:Event):void{

                var myvariable: URLVariables = new URLVariables(e.target.data);

                myValue = myvariable.values;







      PHP file




         echo ('values = 8');






      But I always get the error and cannot get the values by using trace();

      Before i try to use "myLoader.dataFormat = URLLoaderDataFormat.VARIABLES;" I still get the same error.

      Error: Error #2101: The String passed to URLVariables.decode() must be a URL-encoded query string containing name/value pairs

                at Error$/throwError()

                at flash.net::URLVariables/decode()

                at flash.net::URLVariables$iinit()

                at flash.net::URLLoader/flash.net:URLLoader::onComplete()



      Can anyone help me?