Speaking of optimization, SOAP is a shot in your own foot :) However, if
given no choice, I'd go with something similar to decorators.
That is, I'd have an AS3 webservice extending class that would allow to set
/ reset the functional part of it.
Example:

class DecoratedService extends WebService {

public function set decorator(value:IServiceDecorator):void {
this._decorator = value; }

private var _busy:Boolean;
private var _queur:Array = [];

public function call(who:String, whatToSay:Array):Boolean
{
if (this._busy) _queue.push(arguments);
else
{
this._decorator["who"].apply(this._decorator, whatToSay);
this._busy = true;
}
}

private function resultHandler(event:Event):void
{
if (this._queue.length < 2) this._busy = false;
this.call.apply(this, this._queue.shift());
}
// same for result handler

Sorry, I was typing it right here, but the idea should be visible :)

Best.

Oleg

Reply via email to