CLOSE AN AIR APPLICATION

I am writing an air application.  If a user clicks the close button upwards in the title bar, I want to be able to create a pop up asking if they would like to save their project before returning.  The problem is that the program stops just without display the popup window.  I'm listening for a 'close' event and then calling a Manager to deliver the pop-up.  Using tracing instructions, I can confirm that this is what makes my manager, but the application closes even if I do not issue a statement close() or exit().  Here are the XML and actionscript code I (States and import instructions are not included for brevity):

<s:WindowedApplication xmlns:fx="http://ns.adobe.com/mxml/2009" 
                                                     xmlns:s="library://ns.adobe.com/flex/spark" 
                                                     xmlns:mx="library://ns.adobe.com/flex/mx" width="1050" height="765"
                                                     applicationComplete="init()"  close="closeApplication(event)">

     <fx:Script>
          <![CDATA[               

                    protected function closeApplication(event:Event):void
               {
                         if (this.currentState == "main" || this.currentState == "first" || this.currentState == "second"){
                                   trace("true");
                                   var savePopUp:SaveComponent = PopUpManager.createPopUp(videoGroup, SaveComponent, true) as SaveComponent;
                                   savePopUp.title = "Save";
                                   PopUpManager.centerPopUp(savePopUp);
                          }
                         else {
                                        trace("false");
                                    this.exit();
                         }
               }
          ]]>
     </fx:Script>

</s:WindowedApplication>

If the application is in some States, I want the user to receive a popup used to back a project before the program ends, but the program does not wait for give me the order exit() or close().  Is it possible to substitute for inercept, or something?  Or listen to a different event?

I found this one on my own.  At the top of the closeApplication Manager, simply add this line:

Event.preventDefault ();

This causes Flex to not close the program that is the default setting by clicking on the close"" button.  In addition, you must use NativeApplication.nativeApplication.exit () to close all windows of the application instead of this.exit () like I did.

Tags: Flex

Similar Questions

  • Changed to aaa when exporting xml doc in AIR application XML namespaces

    When I export my xml in a Format of TimedText leave an AIR application, that I'm working on xml namespaces change to aaa instead of xml... anyone knows how to fix this or prevents the application to change arbitrarily.

    Another question, for some reason any code I have, as to the format now, won't let me not use the appendChild method to add my cuepoints to the FTT xml document.

    Any advice would be greatly appreciated.  My code is below:

    Create final XML

    private void submit (): void

    {

    If (boolVideoSelected is true)

    {

    xmlData =

    " < tt XML: lang ="fr"xmlns =" http://www.w3.org/2006/04/ttaf1 "xmlns:tts =" " http://www.w3.org/2006/04/ttaf1#styling ">

    < head >

    < style >

    < style id = '1' tts:textAlign = 'center' tts:backgroundColor = 'gray' tts:color = 'white' tts:fontSize = '14' 'product' = tts:fontFamily / >

    < / style >

    < / head >

    < body >

    < div XML: lang = "fr" style = "1" >

    < / div >

    < / body >

    < /tt >;

    var cue: XML;

    var strTempDuration:String;

    var strTempTime:String;

    var strTempContent:String;

    vidVideo.pause (); Break video

    btnPlay.label = ' > ';

    for (var i: int = 0; i < stateArray.length; i ++) //Convert stateArray in XML

    {

    strTempDuration = stateArray [i].duration.toString ();

    strTempTime = stateArray [i].time.toString ();

    strTempContent = stateArray [i].content.toString ();

    cue = < p starts hard = {strTempTime} = {strTempDuration} > //Generate {strTempContent} < /p > cue

    trace (XMLDATA);

    xmlData.body.div.appendChild (cue); Insert markers in XML in order

    }

    xmlFile = new file;

    xmlFile.browseForSave ("save the XML file"); Window open for save location

    Event listeners


    xmlFile.addEventListener (Event.SELECT, xmlFileSelectHandler);
    xmlFile.addEventListener (IOErrorEvent.IO_ERROR, ioHandler);
    xmlFile.addEventListener (SecurityErrorEvent.SECURITY_ERROR, securityHandler);
    }
    }

    private void xmlFileSelectHandler(e:Event):void {}
    var newFile:File = e.target as file;

    If (! newFile.extension | newFile.extension! = "xml") //Check .xml was included in the user's input
    {
    newFile.nativePath += ".xml"; Add .xml file name, if it was not included
    }

    var stream: FileStream = new FileStream();
    Stream.Open (newFile, FileMode.WRITE);
    stream.writeUTFBytes (xmlData.toString ()); Write the XML string in XML file
    Stream.Close ();
    }

    xmlData = http://www.w3.org/2006/04/ttaf1.

    xmlns: XML = ""http://www.w3.org/XML/1998/namespace"

    xmlns:TTS ="http://www.w3.org/2006/04/ttaf1#styling" >. "

  • Since updating my iPad iOS 10, using the button home to close or open applications re works intermittently

    Since updating my i Pad for ios 10, the ability to close or restore applications open with a double-tap the home button, now does only intermittently.  Yesterday, it was not working.  Today, it was and I was able to close open approximately 20 applications. Now, it does not, once again.  I've seen some comments somewhere relative to other people with similar problems.

    Hello

    Go to settings-general - accessibility to the 'home' enable finger rest for Open button.

    Who can help.

    See you soon

    Brian

  • all of a sudden, I can't mail. everything is grey. I also tried to update and I can't close the mail application

    all my e-mail settings are grayed out. Icant get mail or close the mail application to update

    You can force quit the Mail app by using the keyboard shortcut leave force command + Option + ESC.

    For problems with the mail.

    With the open Mail app go to the menu bar, and then click window > connection doctor

    Use Mail connection doctor

  • Close the HyperTerminal Application using LabVIEW

    I have a client who wants to LabVIEW to close the HyperTerminal Application automatically is the serial port open.

    It is easy to detect that the serial port is already in use.  I already have a popup that tells the operator to close any application communication because the port is already in use; However, they want to do it automatically.

    HyperTerminal is not taken support ActiveX, and they will not go to the version more professional who does.

    For a long time, I had read a thread where it was possible to close (or open)? and demand having no ActiveX support.  I expect to use similar approach...  Opening the app is simple, but closure is another story.  You need some sort of reference to this request to tell Windows that are to close.  The Win - XP operating system.

    Suggestions are welcome.

    R

    http://www.howtogeek.com/HOWTO/Windows/kill-processes-from-the-Windows-command-line/

    OR

    Taskkill (command line as well) http://technet.microsoft.com/en-us/library/bb491009.aspx

    Taskkill /IM hyperterm.exe

    kill hyperterm all windows open, BUT it will ask you if you want to close the sessions open, which I think that you do not want.

    Taskkill /F /IM hyperterm.exe

    voila (without chewing the com port, I just tried)

  • How to close all active applications at the same time on the Acer Iconia A1 840

    On my Android phone, I'm able to close all active applications at the same time the button next to the home button Task Manager. On my Acer Iconia A1 840 I don't have this option here.  Is there another way to do it?

    Thank you.

    Lacoet,

    To my knowledge unless you download a third party such as Advanced Task Killer App, you can only close applications active one at a time. If you are looking for an alternative, I suggest looking at game store of Google for a Task Killer app may be able to contribute to what you want to do.

  • convert adobe flex web app for playbook air application?

    Hey, I am very new to this sort of thing and was using a Visual tool to help me create applications web flex. My question is can I convert these to operate as air apps on the playbook?

    Given that I don't really know action script.

    Also, can you recommend any good books, tutorials, or interactive Web sites that would help me to learn action script? Thank you!

    Some MX controls (OK, a lot) are not supported under the BB SDK.  For example, mx. Alert does not work, you must use the AlertDialog QNX class.  See docs QNX to:

    http://www.BlackBerry.com/developers/docs/airapi/1.0.0/index.html

    In addition, FlashBuilder is the IDE that is supprted, Flex Builder (3.x) is not supprted.  FlashBuilder 4.x is what you need, but which is not supported under Linux.  You should be able to download the 0.9.1 BB SDK for Linux and the use of the CLI version for a project of will.

    If you are a Flex application, you need to change the root node of a node (Application or WindowedApplication) AIR (if not already done).  If so, act like and more taking orders from MX which are not supported, I keep your business logic and simply change the front-end server with native controls of QNX/BB.

    But first, I would try just get a "Hello World" application to compile and run as an AIR application and then send it on the Simulator to get their feet wet.  then see what it would take to get your application scope.

    Hope that helps.

  • What devices are supported for an Adobe Air application?

    What devices are supported for an Adobe Air application?

    A BlackBerry app created with Adobe Air (Air 2.5) work on a BlackBerry 9900 for example?

    Thank you.

    Only phones PlayBook and BB10

  • Avoide auto of interlock of AIR application

    I have a game that is based on the accelerometer and the user did not interact with the game, that the tipping of the unit. As a result the unit gets locked automatiocally and I want to avoide that.

    Is there a way by which I can avoide lock in AIR application?

    Thank you!

    Yes, to prevent locking to prevent sleep.  This means that your app will drain more battery life however, so add events to watch the life of the battery.

    That's what I have in one of my apps that seems to work well

    qnx.system.QNXSystem.system.inactivePowerMode = QNXSystemPowerMode.THROTTLED;

    qnx.system.QNXSystem.system.powerMode = QNXSystemPowerMode.NORMAL;

    flash.desktop.NativeApplication.nativeApplication.systemIdleMode = "keepAwake";

  • FLV support in Adobe AIR application

    Hi all

    I am very new to Adobe Air application. Using Adobe AIR is possible to read .flv files... Any help will be appreciated.

    Yes, they're going to play.

  • Flash Builder 4 doesn't have the 'BlackBerry Tablet AIR Application".

    I'm trying to get the HelloWorld application to work, but I can't find the "BlackBerry Tablet AIR Application" option. It should appear in the debug configuration, but it's not.

    I already have the Simulator works and correctly installed the Playbook SDK (link to version 2.5 SDK and Flash Builder). I have no error in compilation (QNX namespaces are used), I think that the installation has been correctly executed.

    Any ideas?

    You need to update to 4.0.1 FB. See release notes.

  • Connection of an iOS to the debugger in Adobe air application animate

    Hello

    I need to connect my iOS to Adobe AIR application to a debugger, a debugger will work. When I publish my Animate app crashes before it can connect, leaving behind an app still works on my phone. But there is no obvious way to connect to a console at the breast of animate it using "debug" or "start the remote debugging session. With the Simulator, it will connect as long I give IP address appropriate, it will connect. I don't have that option in my app on iOS. My iPhone or iPad will connect. How can I get this done?

    Apparently, the debugger to connect if you do not set the install on the flag of the device. But I found that animate them for Windows doesn't crash as it does on Mac OS. So the question is now moot.

  • When you try to install CS6, an appeard message to "Close the following applications..." Apps that I can't find. namely, SafaricloudHisto and SafariNotifications

    When you try to install CS6, a message is displayed to 'close the following applications... " Apps that I can't find. namely, SafaricloudHisto and SafariNotifications

    Any help will be appreciated.

    Thank you

    R.J.K.

    I found the apps in the utility folder...

    A big thank you to anyone answering

    RJK

  • Why not throw my Adobe AIR applications?

    Hello

    I am on Mac OS 10.11.1 and I managed to install the latest version of AIR. However, none of my applications that require AIR will launch. When I double-click on the icon of the application to launch, a space appears in the dock as if the application icon is about to appear, but he never does. That's all. I have uninstalled, reinstalled, etc., but have not been able to get this fixed a problem.

    Any suggestions are greatly appreciated.

    Thank you

    I was finally able to solve the problem that was caused by file permissions is stripped. It seems that during the launch of an AIR application, it tried to rename a file that I don't have write access to the. I gave myself the opportunity to write on this file and now it works.

  • Test an AIR application on iOS device, without being an Apple Developer.

    I know that it is now possible to test an application on a device iOS WITHOUT be paid member of the Apple Developer program.  How do I do that?

    The way I've done things before, was to go on my developer account Apple - device UDIDs to type and create the commissioning of profiles and certificates.  I also used TestFlight - but this also requires a paid membership.


    So, what's the new way?

    OK - it worked!

    You need XCode 7.  Create a new iOS XCode project.  (A simple display application - regardless)  But the Bundle ID must be the same as your white AIR app ID (the same that in your configuration xml AIR fie .).

    Plug in your device, and then run the XCode application on your device.

    In XCode, you can consult your commissioning profiles - and display them in the Finder.  You will need one for this application ID.  (I did a copy).

    Then - Keychain Access (in the Utilities folder) and find your certificate listed under 'my certificates). Export it as a .p12 file (and give it a password).

    Now, you can use the .mobileProvision and .p12 file and the password, to build your AIR application to deploy your device!

Maybe you are looking for