This content has been marked as final. Show 3 replies
The error you're seeing makes me believe you're not working in an AIR project. Specifically, you do not have airglobal.swc in your library path.
To create an ActionScript project destined for AIR, you need to:
1. Select File->New->AIR Project.
2. in the New Project Wizard, get to the screen that specifies your main file name (which will be projectName.mxml)
3. Rename the file to projectName.as
4. Click Finish.
(yes, it's a little weird. We're working on it).
If you are, in fact, working in an AIR project, you can capture the close button click by listening for the "closing" event.
Thanks so much, Sasha. I've gotten a bit farther. I've added this line:
var n:NativeWindow = new NativeWindow(true, new NativeWindowInitOptions());
The SFW still builds, but when I run/open it, I get this runtime error:
VerifyError: Error #1014: Class flash.display::NativeWindow could not be found.
I'm sure I'm just missing a piece of the big picture here. Maybe that isn't how you're supposed to run an AIR-based SWF?
Right. So the way to run an AIR swf is to pass the AIR runtime the XML file that defines your application.
It sounds like you are trying to run a SWF compiled for AIR in the regular Flash Player runtime, which won't work. SWFs compiled for the AIR runtime will only run in that runtime.
Have you downloaded the AIR beta? It should have some example projects for you. However, you can try this all out in Flex Builder by creating a new AIR project as I described above.
One caveat is that we have not yet implemented the ability to prevent maximizing the initial AIR window, so what you're trying will require that you do create a secondary window. See the Labs Wiki for an example.