Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/video/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Http flash中的空xml响应_Http_Flash_Actionscript 2 - Fatal编程技术网

Http flash中的空xml响应

Http flash中的空xml响应,http,flash,actionscript-2,Http,Flash,Actionscript 2,我正在反向设计一个旧的flash游戏,在登录过程中,一个POST请求被发送到服务器。 行动脚本2: req.username = inicial.login_mc.username_txt.text; req.password = inicial.login_mc.password_txt.text; xmlResponse = new LoadVars(); xmlResponse.onLoad = function() { xml = new XML(xmlResponse.xml

我正在反向设计一个旧的flash游戏,在登录过程中,一个POST请求被发送到服务器。 行动脚本2:

req.username = inicial.login_mc.username_txt.text;
req.password = inicial.login_mc.password_txt.text;

xmlResponse = new LoadVars();
xmlResponse.onLoad = function() {
    xml = new XML(xmlResponse.xml);
    trace("login xml: " + xml);

    user = xml.childNodes[0];
};

url_login = "api/auth/user";
req.sendAndLoad(url_login, xmlResponse, "POST");
请求:

请求URL:http://localhost:3000/api/auth/user
申请方式:邮寄
状态代码:200 OK
远程地址:[::1]:3000
推荐人策略:降级时无推荐人
用户名:aaaa
密码:aaaa
我的答复是:

连接:保持活动状态
内容长度:58
内容类型:application/xml;字符集=utf-8
日期:2018年3月18日星期日20:19:50 GMT
ETag:W/“3a-G4M/BpWRvMgDdvlmOtNMapl/lLw”
X-Powered-By:Express
你好
问题是:flash没有得到任何响应,xml总是空的。flashlog.txt:

警告:getClassStyleDeclaration不是函数
登录xml:
内容类型:text/xml不起作用

可能是什么?

这可能会对你有所帮助

var my_xml = new XML(); 
var myLoginReply_xml = new XML(); 

myLoginReply_xml.ignoreWhite = true; 

myLoginReply_xml.onLoad = function(success){ 

    if (success) { 
        // xml response with success
    } else { 
        // failure
    } 

}; 

my_xml.sendAndLoad("YOUR_URL", myLoginReply_xml);

如果您是
我的回复
(以下引用):

我的答复是:

下面的代码有一个提取XML的例子(例如:考虑方法):

var-txt_响应:String=”“//原始响应字符串
var txt_XML:String=“”//(已提取)要转换为XML对象的字符串
//# //////////////////////////////////////////////////////////
//#01)获得响应:
txt\u response=“连接:保持活动\n内容长度:58\n内容类型:application/xml;charset=utf-8\n日期:Sun,2018年3月18日20:19:50 GMT\nETag:W/\“3a-G4M/BpWRvMgDdvlmOtNMapl/lLw\”\nX由:Express\nhowdo供电”;
跟踪(“txt\U响应:\n”+txt\U响应)//检查是否存在预期的响应文本
//# //////////////////////////////////////////////////////////
//#02)从响应中提取XML数据:
//#使用:子字符串(开始位置:编号,结束位置:编号);
var pos_开始:编号=0;
var pos_End:编号=0;
pos\u Start=txt\u response.indexOf(“”);
txt\u XML=txt\u response.substring(pos\u Start,pos\u End+10)//+10达到这个词的结尾(包括它)
跟踪(“txt\U XML:\n”+txt\U XML)//在用作XML之前检查提取是否正确
//# //////////////////////////////////////////////////////////
//#03)将提取的文本转换为XML:
var my_xml:xml=newxml(txt_xml);
trace(“检查XML属性(hello):”+my_XML.firstChild.attributes.hello)//给:世界

使用
my_xml.firstChild.attributes.hello
world
显示为条目。这就是您需要的吗?

我如何更改swf代码?几周前我试过一些工具,但没人用。
Connection: keep-alive
Content-Length: 58
Content-Type: application/xml; charset=utf-8
Date: Sun, 18 Mar 2018 20:19:50 GMT
ETag: W/"3a-G4M/BpWRvMgDdvlmOtNMapl/lLw"
X-Powered-By: Express>
<response hello="world"><hi>howdoing</hi></response>
<response hello="world"><hi>howdoing</hi></response>
var txt_response :String = ""; //original response string
var txt_XML :String = ""; //(extracted) string to be converted into XML object

//# //////////////////////////////////////////////////////////
//# 01) Get the Response :

txt_response = "Connection: keep-alive\nContent-Length: 58\nContent-Type: application/xml; charset=utf-8\nDate: Sun, 18 Mar 2018 20:19:50 GMT\nETag: W/\"3a-G4M/BpWRvMgDdvlmOtNMapl/lLw\"\nX-Powered-By: Express\n<response hello=\"world\"><hi>howdoing</hi></response>";
trace("txt_response : \n" + txt_response);//check if expected Response text


//# //////////////////////////////////////////////////////////
//# 02) Extract XML data from Response :
//# using: substring (start_Pos:Number, END_Pos:Number);

var pos_Start :Number = 0;
var pos_End :Number = 0;

pos_Start = txt_response.indexOf("<response");
pos_End = txt_response.indexOf("/response>");

txt_XML = txt_response.substring( pos_Start, pos_End+10); //+10 to reach end of this word (include it)
trace("txt_XML : \n" + txt_XML); //check if correct extract before using as XML


//# //////////////////////////////////////////////////////////
//# 03) Convert extracted text to XML :

var my_xml:XML = new XML(txt_XML);
trace( "checking XML attribute ( hello ) : " + my_xml.firstChild.attributes.hello); //gives: world