If you have code that follows the service call that needs the data then this code needs to be moved into the resulteventhandler.
the code that runs after the database access, accesses the db again
multiple times and while reading those results in a loop accesses the
database possibly multiple time in a third loop.
I was wondering if the another event listener could be registered at each
level to respond to the same event (ResultEvent from the HTTPservice call).
Maybe I could put a timer in the second event handler to delay if for a few
milliseconds befor it attempts to process the result data set.
I have come up against this problem time and time again while trying to
get FLEX to execute function calls sequentially in a particular order. I'm
beginning to wonder if it is even possible although others must have
solved this issue.
Reading a row from a table and then based on the primary key reading
all rows in a linked table containing that key as a foreign key is a
typical operation performed time and time again and I can't believe this
not possible in FLEX.
Thanks for your help,
It's not possible, AS is asynchronous.
Have you looked at doing the looping/logic on server side and just passing the data back to the client one time?
You need logic loops,
for example I have a db with embedded images, first call I get all records less the images, I then set a counter to 0 and call a function to get the first image, the result then fires the fetch function again if needed. This way you are looping after the info for each record is recieved.
retreiveimage(myrecord[counter].ID); <===service call for record
........ do manipulation stuff
if (counter < myrecord.length) getImage()
well I had to do a major re-write of the code but
your suggestion has definitely worked.
Thanks much for your help.