在 AS3 错误 #1069 中:属性系统在字符串上找不到结果,并且没有默认值


In AS3 Error #1069: Property systemResult not found on String and there is no default value

我是使用xamp集成Flash,php和mysql的新手。我尝试了很多来纠正这个错误,但我不能这样做,因为我不知道错误是在 php 页面中还是值没有传递给 php。

这是我的AS3代码:

public function processLogin ():void {

            trace("inside the processlogin method");
            var phpVars:URLVariables = new URLVariables();
            var phpFileRequest:URLRequest = new URLRequest("controlpanel.php");         
            phpFileRequest.method = URLRequestMethod.POST;          
            var phpLoader:URLLoader = new URLLoader();
            phpLoader.dataFormat = URLLoaderDataFormat.VARIABLES;           
            phpLoader.addEventListener(Event.COMPLETE, showResult);
            phpVars.Username = Username.text;
            trace(phpVars.Username);
            phpVars.password = password.text;
            trace(phpVars.password);
            phpFileRequest.data = phpVars;
            trace("phpvariable"+phpVars);
            phpLoader.dataFormat=URLLoaderDataFormat.TEXT;
            phpLoader.load(phpFileRequest);
        }
        public function showResult (event:Event):void {             
            trace("show result");           
            result_text.autoSize = TextFieldAutoSize.LEFT;      
            result_text.text = "" + event.target.data.systemResult;
            trace(event.target.data.systemResult);  
        }
    }

这是控制台中的输出:

sucess
now im in checklogin
inside the processlogin method
raj
raj
phpvariableUsername=raj&password=raj
starts process login method
show result
ReferenceError: Error #1069: Property systemResult not found on String and there is no default value.
    at actions::main/showResult()
    at flash.events::EventDispatcher/dispatchEventFunction()
    at flash.events::EventDispatcher/dispatchEvent()
    at flash.net::URLLoader/onComplete()

对应的 php 页面是

<html>
<body><?php 
include("connect.php");
 $username = $_POST['Username'];
 $password = $_POST['password'];
$query = mysql_query("SELECT * FROM users WHERE username='$Username' AND password='$password'");
$login_counter = mysql_num_rows($query);
while ($data = mysql_fetch_array($query)) 
{
$userbio = $data['user_bio'];
print "systemResult=$userbio";
}
?>
</body>
</html>

错误消息说明了一切 - event.target.data是一个字符串 - 它没有属性systemResult

只要看看event.target.data,这应该是响应的html代码。