For whatever reason, setting content-disposition stuff didn't work for me and was running out of time. What I ended up doing was this,
- User clicks a button to generate the file on the Java side and save it to the server. - In Flex, when server returns the usual XML response saying all is OK, I dynamically add a button to the app to handle the download using a FileReference object. - On successful download (Event.COMPLETE), I delete the button from the app. - Alex --- In flexcoders@yahoogroups.com, Mika Kiljunen <mkintens...@...> wrote: > > Yep I have the same problem and get the same error. But funny enough, my app > works perfectly with Flash Player 9, but fails with Flash Player 10 throwing > "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." > > -Mika > > > > On Wed, Jan 21, 2009 at 6:51 PM, valdhor <valdhorli...@...>wrote: > > > 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 <flexcoders%40yahoogroups.com>, > > "oneworld95" <oneworld95@> 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 > > > > > > > > > >