I have facing issue with asynchronous behavior of remote methods and event calls in flex. I need to synchronize my code. How can I do this?
Following is the scenario of my application.
1- I have a component file comp.mxml that dispatches the custom event myEvent to main.mxml file.
2- In main.mxml, the listener for myEvent is defined that uses remote object to call java method produceData.
3- The produceData method of java took 15 to 20 seconds to finish. It uses some utility program to generate and write the data on file (depending upon OS
algorithms and hardware used)
4- When produceData method finishes its task to produce and write data on file, next I have to make another call from main.mxml to read that file. (Currently
I am using timer and make the call to read that file after 20 seconds)
5- reading the file also took 5 to 10 seconds to complete. I have to use this data in my comp.mxml file which is another synchronous behavior. (Currently I
am also using timer for this, unfortunately this is not a good approach).
Retrieving data ...