开发者

synchronous httpservice requests in Flex

开发者 https://www.devze.com 2022-12-12 14:51 出处:网络
Is it possible to make httpService Requests synch开发者_开发知识库ronous in Flex? if yes pls tell me how to do this.

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

精彩评论

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

关注公众号