Note that there are some explanatory texts on larger screens.

plurals
  1. POHow do I cancel an AMF Call with NetConnection?
    primarykey
    data
    text
    <p>Let's say that I have a NetConnection Object inside a Singleton Pattern that is shared with all Data Access Object classes throughout all my application. Now, you went on a screen and asked to load 5 thousands of records because you want to search for some mistake or whatever. But now you just realized that you're in the wrong screen and you actually wants 5 thousand of records from another "Entity". How to prevent you from having to wait almost 2 minutes until the data gets here so you can move on to another Screen and ask for some different data? I tried using ESC button as a key caller to the <code>NetConnection.close()</code> event, but it actually doesn't work. It just dispatch an empty event and the call still returns. I know that I can't ask the server not to keep doing his job, but I wanna know how I can make sure that after you pressed ESC or something like that, the ActionScript won't bother with that specific call anymore and you can move on with your life. And, when the server respond to that call, in the background, I'm going to throw it away because you already agreed to cancel it.</p> <p>Ps.: I don't have any doubt on how to listen to ESC button and call some method through it, I just want to know what to call once the user decided that he doesn't want to receive that data anymore and he/she wants to move on without having to close the App and open again.</p> <p>Edit: </p> <p>I tried to destroy the Responder object after making the call, but it didn't work.</p> <pre><code> public function call(command:String, f:Function, fault:Function, ...parameters):void{ var r:Responder = new Responder(f, fault); this._Responder = r; if(parameters.length == 0) GATEWAY.call(command, _Responder); else GATEWAY.call(command, _Responder, parameters); } public function close():void{ _Responder = new Responder(function(obj:Object):void{}, function(obj:Object):void{}); //_Responder = null; trace("Canceled"); } </code></pre> <p>with the code described up here, I stopped making calls to <code>NetConnection::call</code> and started to call the "Call Function" that I wrote. So this function would build a Responder that will be in the class scope so I could access it even after the call has been made and the ESC button would call the "Close" function. I tried setting it to null and re-building it. It didn't work. I think after the NetConnection makes the call, the Responder cannot be changed. </p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload