Actionscript 3 AS3中的特殊字符
我有一句话:Actionscript 3 AS3中的特殊字符,actionscript-3,special-characters,Actionscript 3,Special Characters,我有一句话: mySharedObject.data.theDate = "25/12/15"; 如果我进行跟踪,它会返回 25%2F12%2F15 如何使其返回: 2015年12月25日 (显然“/”是由%2F”翻译的…) 编辑 我试图发送的变量返回:25%2F12%2F15 这是我的密码: mySharedObject.data.theDate = "25/12/15"; trace(mySharedObject.data.theDate); urlVars.thedate
mySharedObject.data.theDate = "25/12/15";
如果我进行跟踪,它会返回
25%2F12%2F15
如何使其返回:
2015年12月25日
(显然“/”是由%2F”翻译的…)
编辑 我试图发送的变量返回:
25%2F12%2F15
这是我的密码:
mySharedObject.data.theDate = "25/12/15";
trace(mySharedObject.data.theDate);
urlVars.thedate = mySharedObject.data.theDate;
urlReq.data = urlVars;
trace(urlReq.data);
因此跟踪(mySharedObject.data.theDate);
返回:25/12/15
完美
跟踪(urlReq.data);
返回:日期=25%2F12%2F15
你知道有什么问题吗
编辑2: 以下是我的功能:
function sendDataToPHP(evt:Event):void {
// Create a new URLRequest instance sending data to "scriptmareev2.php"
var urlReq:URLRequest = new URLRequest ("scriptmareev2.php");
// Send data using the POST method
urlReq.method = URLRequestMethod.POST;
// The data property of the request is set to the
// URLVariables instance (urlVars) to send to the PHP file.
// Note: urlVars stored the variable (e.g. candidate)
var urlVars:URLVariables = new URLVariables();
urlVars.theport = mySharedObject.data.theCity;
urlVars.thedate = mySharedObject.data.theDate;
urlReq.data = urlVars;
decodeURIComponent(String(urlReq.data));
trace(urlReq.data);
// Create a new instance of the URLLoader class to work with.
// URLLoader.load( ) method should be used when we need the
// sent variables returned back to Flash ActionScript.
var loader:URLLoader = new URLLoader (urlReq);
//specify dataFormat property of the URLLoader to be "VARIABLES"
//This ensure that the variables loaded into Flash with the same variable names
loader.dataFormat = URLLoaderDataFormat.VARIABLES;
//Load the PHP file by using URLRequest
loader.load(urlReq);
trace(loader.dataFormat);
//Listen when the loading of data COMPLETE
//Call the loadComplete function when the loading COMPLETE
loader.addEventListener(Event.COMPLETE, loadComplete);
}
没有。它返回
25%2F%2F12%2F%2F15
我编辑了你的问题,但请澄清你的代码中确实有引号?还有,你说“返回”“,上下文是什么?是否将此变量指定给文本字段?还是追踪?还有别的吗?URL变量是编码的,这就是为什么它看起来是这样的。对它们进行解码使其恢复正常我对变量有点陌生。如何解码urlVars.thedate
?decodeURIComponent(字符串(urlReq.data))代码>