webservice calls from flex are asynchronous. therefore im not sure what problem are you having you are users should still be able to move around your site. you can also put a timer in your application and then just load images sequentially in the order you preffer.
look at the using something like this.
public var timer:Timer = new Timer(10)
Thanks for the reply but the for loop finishes and the asynchronous event of receiving the images still occurs.
For example, the for loop loads 500 images. The web service takes 2 or 3 mintues to process all the images and returns them into each requesting Image component. The Close button calls the removeAllElements from the Images' parent so they no longer appear on the screen. However, the browser is still receiving the images. You can see the transfering data message flick on and off in the status line al the bottom of the browser.
The web service hasn't received all the requests at this point so they are still in transit from the browser to the web service.
Using a timer to load the images just means the images requests take longer to send to the web service.
What I need to do is cancel all image load requests when the user presses the Close button.
Hope this make sense.
i guess you can put a condition to run the result handler function that handles the service. In other words put a boolean value in your code and set it to true when you want to stop passing images to the arraycollection depending on your predefined condition. so when the user pressess the close button set the variable to false which will then not allow result handler to load more images. basically skipping loading images.
hope this make sense
Message was edited by: miguel8312
Sorry Miguel, I don't think you quite understand the issue. Its not the result handler that is receiving the images it is the Image component - which no longer exists on the stage.
you have an image component that is getting the image from a webservice? Right? If the answer to this is yes the webservice call is going to bring back all the images as long as their images to be retrieved. How do the images get assign to the component? no result handler? I guess i m just confused you prob need to post some source that would be more helpful.
Hi Miguel, many thanks for help so far. I believe I has resolved my problem. The event handler was the key to it. I was loading all the images simultaneously by requesting them with the load function of the Image components. I've changed this to add the Complete event on each image and load one image at a time as the previous one completes. If the user presses Close (stop) then the requests stop. It is slower because I have to wait for each image to complete the load process but it means I have more control.