Once you create the zip file you need to return the correct headers to
the browser so that the browser will pop up the dialog box asking the
user what to do.

I don't use Java - I use PHP. When the user clicks a button in Flex I
create a new URLRequest and then navigateToURL. The PHP script creates
the file and when done sends the following headers:

Header("Content-type: application/octet-stream");
Header("Content-disposition: attachment; filename=zipTest.zip");

The script then streams the file to the browser. The headers sent back
to the browser cause the browser to pop up the save file window just
as if the user clicked a file link on an HTML page.





--- In flexcoders@yahoogroups.com, "oneworld95" <oneworl...@...> wrote:
>
> I've run into an interesting situation with Flex: I've got a Java
> servlet that will generate a Zip file when the user clicks a button in
> Flex. But the file download dialog after the server action requires
> the user to click a button. It throws this error:
> 
> Error: Error #2176: Certain actions, such as those that display a
> pop-up window, may only be invoked upon user interaction, for example
> by a mouse click or button press.
> 
> So how do you handle these situations? After the server responds
> successfully, do you display a second button to do the actual Flex
> file download? 
> 
> - Alex
>


Reply via email to