私のAS3コード:
loginBtn.addEventListener("mouseDown", sendData)
function sendData(e:Event) {
var path:String = "http://server1.digitalmulia.com/~testing/webservice/auth/login";
var myData:URLRequest = new URLRequest(path)
myData.method = URLRequestMethod.POST
var variables:URLVariables = new URLVariables()
variables.username = usernameField.text
variables.password = passwdField.text
myData.data = variables
var loader:URLLoader = new URLLoader()
loader.dataFormat = URLLoaderDataFormat.VARIABLES
loader.addEventListener(Event.COMPLETE, dataOnLoad)
loader.load(myData)
}
function dataOnLoad(e:Event){
var xmldata = XML(e.target.data);
var xxx = xmldata.toString();
var myFormat:TextFormat = new TextFormat();
myFormat.font = "Arial";
myFormat.size = 12;
myFormat.bold = true;
var myText:TextField = new TextField();
myText.defaultTextFormat = myFormat;
myText.selectable = true;
myText.border = true;
myText.text = xxx;
myText.x = 10;
myText.y = 200;
myText.width = 300;
myText.height = 100;
addChild(myText);
}
stop()
結果:
%3C%3Fxml%20version =%221%2E0%22%3F%3E%0A%3Cxml%3E%3Cdatas%2F%3E%3Cinformation%3E%3Cpasswd%3E5f4dcc3b5aa765d61d8327deb882cf99%3C%2Fpasswd%3E%3C%2 3Cerror%3E%3Citem%3EUsername%20not%20found%20or%20password%20is%20wrong%3C%2Fitem%3E%3C%2Ferror%3E%3C%2Fxml%3E%0A
どうしたの?私が必要とする結果は
<xml>
<datas/>
<information>
<passwd>5f4dcc3b5aa765d61d8327deb882cf99</passwd>
</information>
<error>
<item>Username is null</item>
<item>Password is null</item>
</error>
</xml>
英語が下手でごめんなさい。