Hi!
I have problem sending a JSON obejct from a flash program to a server. It looks like the program get stuck in URLloader.load() call. It would be to great help if someone knew what was wrong.
The server is currently just listening on port 8080.
class Main extends Sprite {
public function new () {
super ();
var fileContents:String = "Something";
var name:String = "name1";
var urlRequest:URLRequest = new URLRequest("http://localhost:8080");
urlRequest.method = URLRequestMethod.POST;
urlRequest.data = Json.stringify({name:name, content:fileContents});
urlRequest.contentType = "application/json";
urlRequest.requestHeaders.push( new URLRequestHeader( 'Cache-Control', 'no-cache' ) );
var textField: TextField = new TextField();
addChild(textField);
var titleFormat = new TextFormat();
titleFormat.color = 0x000000;
titleFormat.size = 40;
textField.defaultTextFormat = titleFormat;
textField.selectable=false;
textField.text = "Click to upload";
textField.x = 500;
textField.y = 500;
textField.width = 500;
textField.height = 500;
textField.addEventListener(MouseEvent.CLICK, function(e){
var urlLoader:URLLoader = new URLLoader();
urlLoader.dataFormat = URLLoaderDataFormat.TEXT;
urlLoader.addEventListener( Event.COMPLETE, onComplete);
urlLoader.addEventListener( HTTPStatusEvent.HTTP_STATUS, onHttpStatus);
urlLoader.addEventListener( IOErrorEvent.IO_ERROR, onIOError );
urlLoader.addEventListener( SecurityErrorEvent.SECURITY_ERROR, onSecurityError );
urlLoader.load( urlRequest );
});
}