Mailing List
Home
Flash Pro
Extending Flash
Flash Macromedia Developer
Subjects
Firework Effect
setInterval bug identified and fixed
setInterval bug identified and fixed
ScrollPane component doesn 't auto update
Help: MX 2004 How to script a print button to print the entire sli
Event Dispatcher between classes
memory management removeMovieClip /
MX2004 Dataset itemClassName
Order of events per frame
XML to Object help
Textfield prototype question
Flash and QuickTime VR
Reading and displaying RSS feeds in Flash MX
Flash MX 2004 Sucks
AW: [Flashcoders] Switch/Case vs If/else
AW: [Flashcoders] Switch/Case vs If/else
Flash Interface with 10mb xml file
Web Service Results
Listener Object 's best practice
 
Search:  
Power your search with and, or, +, -, or "some phrase" operators.
Asynchronous Loadvars calls?

Asynchronous Loadvars calls?

2004-02-17       - By Ashley Rajaratnam

 Back
Reply:     1     2  

Hi All-

The application in question currently uses the LoadVars object to call a
host server in a synchronous manner i.e.

   1. call the host
   2. lock screen input wait for response from server
   3. get response/ or time out continue

this works fine however I 've decided update the application to allow the
user to asynchronously call the host i.e.

   1. call the host
   2. don 't wait allow user to call host again if he/she wants
   3. handle the response and update interface as server
responses/come back

The code (pseudo) looks like this:
__ ____ ____ ____ ____ __
UI Class to capture events from interface

SomeUI.prototype.UIRequestToHost = function (CallID) {
   this.GatewayModel.callHost(CallID);
}

__ ____ ____ ____ ____ ___
Model Controller class actually does the calls

GatewayModel.prototype.callHost = function(callerid) {

var objLoadVars;
objLoadVars = new LoadVars();
objLoadVars.returnID = callerid;

objLoadVars.onLoad = function(success) {
if(success){
    _global.gateway.hostResult(objLoadVars);
} else {
_global.gateway.hostFailed();
}
}

//send and load the data
objLoadVars.sendAndLoad(( "http://blah/pause10seconds.asp "),objLoadVars,
"POST ");

}


Pretty simply...

I 'm encountering a strange behaviour which makes me believe that the
Loadvars object shares a single connection or queues the calls to the
host.


I call
UIRequestToHost() which in turn invokes callHost()

Multiple times within a second / pretty much instantously with values
1,2,3,4,5,6,7,8....

On the server
I created a simple ASP page that pauses 10 seconds then returns a
result.

The problem:
I would expect all the results to come back around 10 seconds however
this is not the case
It takes 10 seconds x the number of calls for the last call to come back

Each call comes back in the order that I called.

It seems as if LoadVars internally queues the requests and waits until
the request has come back until it fires off the next request.

Im contemplating writing a queuing system before each call to loadvars
but I thought the whole purpose of Loadvars was that it had the
capablitlity to asynchronously call a host... so I think maybe there is
something wrong with my syntax?

Any help you could provide would be greatly appreciated!!!

Thanks in advance
Ash



=-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- --
Supported by Fig Leaf Software
=-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- --
Be sure to check the archives and the wiki:
http://chattyfig.figleaf.com/
=-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- --
http://chattyfig.figleaf.com/cgi-bin/ezmlm-cgi?1:mss:104487
=-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- --
To unsubscribe send a blank e-mail to:
Normal Mode: flashcoders-unsubscribe@(protected)
Digest Mode: flashcoders-digest-unsubscrive@(protected)