I’m fairly sure that there is no way to use SWF2JAR to bundle a Flash Lite SWF into a JAR package and be able to exit cleanly from the SWF. So this means using Eclipse (or your JME editor-of-choice) to do your packaging.
I’ve created a simple JME project that shows how to do this. In a nutshell, you need to use the `DataRequest` API in Capuchin to send a request to Java to quit the app. The files in the project show how this can be done; it’s all pretty simple, if you read through the `DataRequest` example in the Project Capuchin docs. I did not include the `DataRequest.as` file from the Capuchin examples/tutorials package since I’m not using classes in the example; so, depending on how your app is set up, you may need to include this when publishing your SWF.
At minimum, if you want to use this to just create a quittable Flash Lite app that uses no other Capuchin APIs, then:
- replace your `fscommand2(“Quit”)` with the appropriate code from the sample FLA;
- drop your swf in the res/ directory of the project
- find this line of code in src/FLClose.java:
`InputStream inp = getClass().getResourceAsStream(“/FLTest.swf”);`
and change `FLTest.swf` to the name of your SWF;
- build the project and package it.
That’s the minimum required to get this working. Bear in mind that you will need to edit the JAD file to change the name of the app in the menu, if you want to use a custom icon, etc.
(Also bear in mind that I’m new to JME, make no guarantees that this will immediately work for you, etc., etc. I think it’s pretty risk-free, but use at your own risk.)