开发者

synchronous httpservice requests in Flex

Is it possible to make httpService Requests synch开发者_开发知识库ronous in Flex?

if yes pls tell me how to do this.

It was asked to me in an interview.

Thanks


It's not possible.


Well hang on, I mean it depends - you couldn't do it in a functional way, but if we're talking strictly theoretical then you could hack something like this:

var returned:Boolean = false;

function syncService():void {
     httpService.addEventListener(Event.COMPLETE, completeHandler);
     httpService.send();

     while (!returned) {}

     return;
}

function completeHandler(e:Event):void {
     returned = true;
}

I'd never use that in production and it might not even work. It's just asking for time-out errors etc - but in theory that should do it, right?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜