You want to save the data when the browser window closed ???
No need to interact with java and flash.
If you want to save the data when you close particular swf
file in html browser window meant, you can use the js with flash...
Look this link...