Hello!

I happen to have some issues with the onLoad event of the LoadVars object in ActionScript. I am curious if anyone here could tell what could be the possible reasons why the onLoad event
don't get triggered.

The problem I have is that the event don't get triggered while the other to events onHTTPStatus and onData are receiving the actually data received from the POST or GET request. For example, it returns 200 as the http
status and the actual OK (as expected) as the data.

It also seems that the addRequestHeader() command gets ignored?!?!

Could someone tell me what could be the problem? Maybe I am not sending my HTTP headers correctly?
If you can shed some light on it for me... let me please know!

The code I used for this test is:

var result_lv:LoadVars = new LoadVars();
result_lv.onLoad = function(success) { // nothing
   trace( "success:" + success )
   if (success) {
       trace( "success: " + status );
       log("Success! " + result_lv.welcomeMessage);
   } else {
       trace( "error");
       log("Error connecting to server.");
   }
}

result_lv.onData = function(data) {
   trace("R: data:" + data );
   log( "data: " + data );
   if ( data == "OK" ) {
       log("command succesfully." );
   }
}

result_lv.onHTTPStatus = function(status) {
   trace( "R: status: " + status );
   log( "status: " + status );
}

function log(msg) {
   logger.text = logger.text + msg + "\n";
}

//
var send_lv:LoadVars = new LoadVars();
send_lv.onLoad=function(s) {
   trace("success: " + s ); // nothing
}

send_lv.action = "authenticate";
send_lv.username = "23";
send_lv.password = "7cc658971e8f998772bc0a3dda09e834b4d9aede";
send_lv.addRequestHeader( "Contraband-PublicHash", "068c0316e6af2602bbf56cfd85175ff2ae732d02" );
send_lv.sendAndLoad("http://127.0.0.1:8082/";, result_lv, "POST" );

stop();

Thanks in advance!

p.s. Probably overlooking something :/

Yours,
Weyert de Boer

_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

Reply via email to