在AS3错误#1069中:在String上找不到属性systemResult,并且没有默认值

时间:2012-05-05 13:57:30

标签: php actionscript-3 flash

我是新手,使用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>

1 个答案:

答案 0 :(得分:0)

错误消息显示全部 - event.target.data是一个字符串 - 没有属性systemResult

只需查看event.target.data,这应该是响应的HTML代码。