I am having trouble figuring out what to do here.
I am sending images to coldfusion, and using cfzip to create a zip of the images for download.
I am using fileRef.download to download the zip to the user's computer in actionscript.
The problem is that flex will let the user download the zip before it is finished compiling.
So if there are 68 images in the zip on the webserver, depending on how fast you select the save location you could only get 42...or 29....etc.
I tried putting the download function in the return handler for the coldfusion remote object, but fileRef.download must be executed by a mouse-click for security reasons.
Here is the click handler for the "download images" button.
Here is the code below:
public function clickHandler1(event:Event):void
h = 0;
randomFileNum = Math.round(Math.random()*(99999-11111))+11111;
for (t = 0; t < HiResImageCollection.length; t++)
image1 = HiResImageCollection[h];
imgStyleNumber = StyleNumberCollection[h]+ "_" + ColorCollection[h] + pORiCollection[h] ;
h = h + 1;
downloadURL.url = "http://costmesa-svr-17/HIB/ImagesTemp/DownloadedImages" + randomFileNum + ".zip" + "?" + Math.random();
fileRef.download(downloadURL, 'DownloadedImages' + randomFileNum + '.zip');
Thank you for your much needed help.
My server-side knowledge is limited, however have you looked into Flex's AsyncToken? Also this article has info at it:
It seems that using Async may be more ideal, then say, to have a timer that will execute your fileRef.download() a few seconds later. But then again, I am weak on this side of the field.