views:

271

answers:

1

I tried to call a service using a for loop and it seems that only the first service call seems to work. My guess is that once a service is called it needs to wait until result event until it can be called again. How can I workaround this?

Waiting for each service to complete before querying for another is too slow.

Ex.

callresponder id="test" SomeService properly imported through Flash Builder 4

for (var i:int=0;i< pool.length;i++) { test.token = SomeService.getSomething(pool[i].someValue); }

Only one would be successful. Help! I don't want to call after result event!

+1  A: 

Problem: The problem is one call responder cannot be used by multiple service call.

Solution: Make more call responders....

var c:CallResponder;

before each iteration begins

c = new CallResponder(); c.addEventListener(ResultEvent.RESULT, resultHandler); c.token = SomeService.whatEver(something);

Pii
Cool, that might come in handy to know.
invertedSpear
Thanks, invertedSpear. I figured this out in my dream.
Pii