如何用php沟通actionscript3.0?

时间:2014-12-22 10:54:41

标签: php actionscript-3 flash

我正在尝试将动作脚本中的数据发送到php文件。但是我无法与php文件进行通信.am得到这样的错误"未定义的索引:C:\ xampp \ htdocs中的用户名\ As \ basics第2行" .php。  我的代码如下。 / *********动作****************** /

 var str:String = "hi";
 var myscore = 0;
 submit.addEventListener(MouseEvent.CLICK, fl_ClickToGoToAndStopAtFrame_7);

 function fl_ClickToGoToAndStopAtFrame_7(event: MouseEvent): void {
 var myrequest:URLRequest = new URLRequest("http://localhost/As/basics.php");
 myrequest.method = URLRequestMethod.POST;
 var variables:URLVariables = new URLVariables();
 variables.username = str;
 variables.score = myscore;
 myrequest.data = variables;
 var loader:URLLoader = new URLLoader();
 loader.dataFormat = URLLoaderDataFormat.VARIABLES;
 loader.addEventListener(Event.COMPLETE, dataOnLoad);
 loader.load(myrequest);
}
 function dataOnLoad(evt:Event)
 {
   submit.alpha=100;
     //status is a custom flag passed from back-end
  }

/ ********* php code ********************** /

   <?php
     $name = $_POST['username'];
    echo "Result:<input type='text' value='$name'>";
    echo "<param name='movie' value='cmphp.swf' />";
     echo "<object type='application/x-shockwave-flash' data='cmphp.swf'width='1024'  height='500'>";
    echo "<param name='movie' value='FlashVars_AS2.swf' />";

 ?>

0 个答案:

没有答案