AS3中的特殊字符

时间:2015-12-02 22:07:40

标签: actionscript-3 special-characters

我有这一行:

mySharedObject.data.theDate = "25/12/15";

如果我做了追踪,它会返回

  

25%2F12 2F15%

如何让它返回:

  

25/12/15

(“/”由%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);

所以trace(mySharedObject.data.theDate);返回:25/12/15完美!

trace(urlReq.data);返回:thedate=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);
}

0 个答案:

没有答案