【问题标题】:Error #2007 when Trying to pass a single variable to Actionscript 3 with URLLoader尝试使用 URLLoader 将单个变量传递给 Actionscript 3 时出现错误 #2007
【发布时间】:2014-03-29 14:32:36
【问题描述】:

我收到 TypeError: Error #2007:Parameter text must be non-null when passing variables from php to actionscript,

  import flash.events.MouseEvent;
  import flash.net.URLRequest;
  import flash.net.URLLoader;
  import flash.events.Event;

 stop();

 btn1.addEventListener(MouseEvent.CLICK, klik)
 function klik (e:MouseEvent):void
 {
var req:URLRequest = new URLRequest("http://localhost/GAME_FLASH/load.php");
var loader:URLLoader = new URLLoader(req);
loader.dataFormat = URLLoaderDataFormat.VARIABLES;
loader.addEventListener(Event.COMPLETE, complete);
 }

 function complete(e:Event):void
 {
test.text = e.target.data.$a;    => i think this is where my problem lies i got error #2007
 }

在我的 php 中:

 <?php
 $conn=mysql_connect("localhost","root","");

 $db=mysql_select_db("derbie",$conn);

 $query = "SELECT * FROM case"; 
 $result = mysql_query($query);
 $a=10;
 header('Content-Type: text/xml');
 echo "<?xml version='1.0' encoding='utf-8'?>\n";
 echo "<sock>\n";
  echo "<item>" . $a . "</item>\n";
  echo "</sock>\n";
  $closeconn = mysql_close($conn);
  ?>

非常感谢任何形式的帮助。

【问题讨论】:

    标签: php actionscript-3 flash


    【解决方案1】:

    我建议您打开 DevTools 并检查您的 php 脚本的响应。可能这个响应是空的。 将错误处理程序添加到加载程序也非常有用。

    【讨论】:

      猜你喜欢
      • 2011-01-06
      • 1970-01-01
      • 1970-01-01
      • 2016-03-14
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-10-31
      • 2020-09-21
      相关资源
      最近更新 更多