View Full Version : Close and drag for AIR app
djones
02-25-2008, 02:52 PM
I created an AIR weather app. How do I create a way to close it within the app and how can I make the app draggable across the desktop?
paulreitz
02-27-2008, 05:55 PM
I've been having a similar issue, trying to get the air app to close (I'm using Flash CS3). I had been using fscommand("quit"), but that wasn't working. Here's the solution I found, and hopefully you can find something useful in this.
first you have to grab a reference to the native window:
var appWindow:NativeWindow = this.stage.nativeWindow;
For me I was then able to use;
appWindow.close();
hope this helps :)
djones
02-28-2008, 04:15 PM
Your're definitely on track with the nativewindow stuff. How do I make a MC with instance name close_me invoke appWindow.close()?
paulreitz
02-28-2008, 04:20 PM
Is this what you're looking for?
...
close_me.addEventListener(MouseEvent.MOUSE_DOWN, closeApp);
...
...
public function closeApp(me:MouseEvent):void
{
appWindow.close();
}
djones
02-28-2008, 04:33 PM
I got it to work using this
var appWindow:NativeWindow = this.stage.nativeWindow;
close_me.addEventListener(MouseEvent.MOUSE_DOWN, close_window);
function close_window(event:MouseEvent):void{
appWindow.close();
}
LOL missed your reply by a second.. THANKS!
djones
02-28-2008, 04:35 PM
Now if I can just figure out how to drag this thing. I'll be in good shape.
paulreitz
02-28-2008, 04:48 PM
appWindow.startMove();
:)
djones
02-28-2008, 05:30 PM
*bows*
Thanks. Where did you find documentation on nativeWindow?
paulreitz
02-28-2008, 05:38 PM
AS3 Doc (http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/)
It's in flash.display.NativeWindow
|
vBulletin® v3.8.4, Copyright ©2000-2009, Jelsoft Enterprises Ltd.