问题
anyone know how to send JSON in ActionScript 2?
I tried using XML() but it changes all " into " before sending it. Ex:
var callout = new XML({ "name": "John"})
callout.sendAndLoad('http://api.app.com', new XML());
but what gets sent is { "name": "John"}
also cannot upgrade to AS3 (wish i could)
回答1:
Here's how you do it
Create a new class that extends LoadVars and override the "toString" method to return the JSON. You can then use load() and sendAndLoad() to send JSON to an URL
Example:
class SendJson extends LoadVars {
public var data:String; // Put your JSON here
public function toString() {
return data;
}
}
来源:https://stackoverflow.com/questions/11234542/sending-json-in-actionscript-2