Home Tutorials Forums Articles Blogs Movies Library Employment Press Buy templates

Go Back   ActionScript.org Forums > Desktop, Mobile and non-browser Environments > AIR (Apollo)

Reply
 
Thread Tools Rate Thread Display Modes
Old 02-25-2008, 02:52 PM   #1
djones
Registered User
 
Join Date: Mar 2004
Location: Winston-Salem, NC
Posts: 75
Default Close and drag for AIR app

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?
djones is offline   Reply With Quote
Old 02-27-2008, 05:55 PM   #2
paulreitz
Member
 
Join Date: Mar 2007
Posts: 89
Default

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:
ActionScript Code:
var appWindow:NativeWindow = this.stage.nativeWindow;

For me I was then able to use;
ActionScript Code:
appWindow.close();

hope this helps
__________________
gamespokane
paulreitz is offline   Reply With Quote
Old 02-28-2008, 04:15 PM   #3
djones
Registered User
 
Join Date: Mar 2004
Location: Winston-Salem, NC
Posts: 75
Default

Your're definitely on track with the nativewindow stuff. How do I make a MC with instance name close_me invoke appWindow.close()?

Last edited by djones; 02-28-2008 at 04:28 PM..
djones is offline   Reply With Quote
Old 02-28-2008, 04:20 PM   #4
paulreitz
Member
 
Join Date: Mar 2007
Posts: 89
Default

Is this what you're looking for?

ActionScript Code:
... close_me.addEventListener(MouseEvent.MOUSE_DOWN, closeApp); ... ... public function closeApp(me:MouseEvent):void {     appWindow.close(); }
__________________
gamespokane
paulreitz is offline   Reply With Quote
Old 02-28-2008, 04:33 PM   #5
djones
Registered User
 
Join Date: Mar 2004
Location: Winston-Salem, NC
Posts: 75
Default

I got it to work using this

ActionScript Code:
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!

Last edited by djones; 02-28-2008 at 04:35 PM..
djones is offline   Reply With Quote
Old 02-28-2008, 04:35 PM   #6
djones
Registered User
 
Join Date: Mar 2004
Location: Winston-Salem, NC
Posts: 75
Default

Now if I can just figure out how to drag this thing. I'll be in good shape.
djones is offline   Reply With Quote
Old 02-28-2008, 04:48 PM   #7
paulreitz
Member
 
Join Date: Mar 2007
Posts: 89
Default

ActionScript Code:
appWindow.startMove();
__________________
gamespokane
paulreitz is offline   Reply With Quote
Old 02-28-2008, 05:30 PM   #8
djones
Registered User
 
Join Date: Mar 2004
Location: Winston-Salem, NC
Posts: 75
Default

*bows*

Thanks. Where did you find documentation on nativeWindow?
djones is offline   Reply With Quote
Old 02-28-2008, 05:38 PM   #9
paulreitz
Member
 
Join Date: Mar 2007
Posts: 89
Default

AS3 Doc

It's in flash.display.NativeWindow
__________________
gamespokane
paulreitz is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Drag Limits: so close, yet too far MatthewMacMilla ActionScript 2.0 0 02-12-2008 03:59 AM
buttons in drag & drop map nzassenhaus Flash 8 General Questions 1 12-09-2005 04:52 PM
drag n' drop boundries help Pyroclasm ActionScript 1.0 (and below) 2 05-18-2005 10:38 PM
Can u make part of a movieclip respond to drag? ivanjs ActionScript 1.0 (and below) 2 04-02-2004 02:24 PM
AS stops working after Drag - why? Metrov 8 ActionScript 1.0 (and below) 2 03-23-2001 07:10 PM


All times are GMT. The time now is 04:39 PM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2009 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.