AS3:传递给URLVariables.decode()的String必须是包含名称/值对的URL编码查询字符串

时间:2012-12-23 11:22:24

标签: php actionscript-3 flash

我吓坏了。在网上搜索了一个小时,没有任何帮助。我正在尝试将PHP数据加载到闪存,但它不起作用。这是as3代码:

var adressS:URLRequest = new   URLRequest("adress/file.php");

var scriptLoader:URLLoader = new URLLoader();

        adressS.method = URLRequestMethod.POST;

        scriptLoader.dataFormat = URLLoaderDataFormat.VARIABLES; 
        scriptLoader.load(adressS);

        scriptLoader.addEventListener(Event.COMPLETE, handleLoadSuccessful);
        scriptLoader.addEventListener(IOErrorEvent.IO_ERROR, handleLoadError);

        function handleLoadSuccessful(e:Event):void {
            if(scriptLoader.data.resulte == "wrong") {
                error_mc.visible = true;
                    error_mc.gotoAndStop(1);
            } else { ... }

这是PHP:

<?php
    if(!isset($_SESSION['login'])) {
    echo 'resulte='.'wrong';
}
?>

我得到了

  

resulte =错

从PHP开始,所以我想这不是问题,但是当我尝试运行flash文件时,我得到输出错误:

  

错误:错误#2101:传递给URLVariables.decode()的String必须是包含名称/值对的URL编码查询字符串。       at Error $ / throwError()       在flash.net::URLVariables/decode()       在flash.net::URLVariables$iinit()       在flash.net::URLLoader/flash.net:URLLoader::onComplete()

我不知道我做错了什么。

请帮助。

1 个答案:

答案 0 :(得分:1)

scriptLoader.dataFormat = 'variables';

//闪光灯的bug,杀了我几个小时。