Search code examples
apache-flexhttpservice

Flex: Cancel HTTPService.send()?


OK I have an HTTPService that executes the dataLoaded(e:ResultEvent):void function whenever it gets a result from a send() call.

OK so If I call HTTPService.send() and then call HTTPService.send() again before the previous one receives a result, I end up repeatedly running dataLoaded() which is undesirable

What I want is if HTTPService.send() gets called before a previous call to it returns a result. I want to cancel the first call, and only process the result from the last call to HTTPService.send()

I hope this makes sense.

How can I do that??

Thanks!!


Solution

  • Actually HTTPService can manage this for you. It has a concurrency property, which you should probably set to "last".

    More info here: HTTPService#concurrency