• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 889
  • Last Modified:

How do I call the WindowedApplication exit function from a panel in a Flex 4 AIR application?


I have a WindowedApplication with a panel. The Panel has a close button attached to it that when clicked should close the application. I was thinking of doing this by having a var in the Panel
private var controllerWindow : WindowedApplication ;

Open in new window


and an event handler for the close button....

protected function exitButton_clickHandler(event:MouseEvent):void
{
    controllerWindow.exit() ;
}

Open in new window


....but I can't figure out how to initialise the controllerWindow variable in the WindowedApplication MXML file.
0
sunnystar
Asked:
sunnystar
  • 3
  • 2
1 Solution
 
deepanjandasCommented:
Try this static API:

NativeApplication.nativeApplication.exit();


Warm Regards
Deepanjan Das
0
 
sunnystarAuthor Commented:
Great in that the end result of what I want to achieve is captured. Would perhaps be nice to know how an application could pass itself to a subpanel.
0
 
deepanjandasCommented:
I am not sure if I understand your next question correctly - try using NativeApplication.nativeApplication to get hold of the application.

Warm Regards
Deepanjan Das
0
 
sunnystarAuthor Commented:
Hi Deepanjan,

Yeah, thanks for that.

I guess conceptually I was interested in how the 'this' object (in this case the WindowedApplication) can be passed as a parameter to the method of another object (i.e. the Panel) in an MXML file.

i.e. as a parameter in...
<panels:SPanel3 id="thebody" controllerWindow="????"/>

Open in new window


Though now I think about it I guess this kind of thing could be done in the creationComplete event handler as the 'this' keyword works in the fx:Script section.

Rishi

0
 
deepanjandasCommented:
Actually I have never tried to pass the application instance like this, rather I have used the static APIs in these cases :)

Warm Regards
Deepanjan Das
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

The Firewall Audit Checklist

Preparing for a firewall audit today is almost impossible.
AlgoSec, together with some of the largest global organizations and auditors, has created a checklist to follow when preparing for your firewall audit. Simplify risk mitigation while staying compliant all of the time!

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now