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?
精彩评论