Event.CLOSING

Hey all,.

Is there an event similar to Event.CLOSING for the PlayBook?  I wasn't able to get my event handler to trigger on Event.CLOSING and I wish I could clean up some SharedObject values if the app is closed prematurely.

Thank you!

A while back I wrote a post about using Event.CLOSING and related events, including the TOGGLE those.  You probably just not use stage.nativeWindow.addEventListener ()to listen for it.

Tags: BlackBerry Developers

Similar Questions

  • Custom events are not heard or sent successfully

    Hey guys, I did experiments with the writing of my first custom event.  So I have a MovieClip class in the library called "curtains."  He plays an animation and at the end of the animation, I have the code:

    Stop();

    dispatchEvent (new Event ("closed"));

    Now, I create an instance of this MC curtains in my class below.  The custom event is not detected.  Did I put the event listener in the wrong place?  What I've done wrong?

    package {}

    import flash.utils.Timer;

    import flash.events. *;

    import flash.display. *;

    SerializableAttribute public class TransitionTimer extends MovieClip {}

    var localTimer:Timer = new Timer (4000,1);

    curtains: curtains of var = new Curtains();

    public void TransitionTimer() {}

    localTimer.addEventListener (TimerEvent.TIMER_COMPLETE, playTransition, false, 0, true);

    addEventListener (Event.ADDED_TO_STAGE, addedHandler);

    }

    public void addedHandler(e:Event):void {}

    starts the timer which called Transition curtain

    localTimer.start ();

    Adds the event listener for the custom event 'closed' to frame 27 curtains MC.

    curtains.addEventListener ("closed", loadNextScreen);

    }

    public void playTransition(e:TimerEvent):void {}

    addChild (curtains);

    }

    public void loadNextScreen(e:Event):void {}

    trace ("loadNextScreen");

    curtains.gotoAndPlay ("open");

    }

    }

    }

    Thanks in advance for any help

    Add a track to your class TransitionTimer to confirm that it is used as the document class.

    Add a line to the last frame of your movieclip where your 'closed' event is dispatched.

    Copy and paste the instructions of tracing so that might not be obvious what is your problem.

  • dispatchEvent (new Event(""))?

    can any that describe works dispatchEvent, I try google but did not help much, what is the difference between an ENTER_FRAME event? I thought that both of them have the same purpose, only the way it is written is different?

    If you want the code to run repeatedly, you will use an enterframe event.  a typical example would be to animate an object on stage:

    this.addEventListener (Event.ENTER_FRAME, f1);

    Function f1(e:Event):void {}

    SomeObject.x += 3;

    {if(SomeObject.x>stage.stageWidth-SomeObject.Width)}

    this.removeEventListener (event. ENTER_FRAME, f1);

    }

    }

    you would use a custom event to communicate between an object in two different different application fields such as classes or clips.  an example (although I would say not typical) would be to have a button in a loaded swf file, unload the swf:

    in the main timeline of the swf file loaded:

    somebutton.addEventListener (MouseEvent.CLICK, f2);

    function f2(e:MouseEvent):void {}

    this.dispatchEvent (new Event ("closed"));

    }

    in the loading swf file:

    var loader: Loader = new Loader();

    loader.contentLoaderInfo.addEventListener (Event.COMPLETE, f3);

    Loader.Load (new URLRequest ("swfwithsomebutton.swf"));

    function f3(e:Event):void {}

    MovieClip (loader.content) .addEventListener ("closed", f4);

    }

    function f4(e:Event):void {}

    loader.unloadAndStop ();  FP 10 + for unloadAndStop() or you must use unload()

    }

    ////////////////

    p.s. Please check the useful/correct, if there is.

  • Hide the window instead of closing

    Hello!

    I'm pretty new to flex development and currently trying to hide a window instead of close, in order to reopen more later (to keep all of the associated variables and components of the defined window).

    I have experience of strange errors between systems.

    Here's the situation:

    I had a window:

    (in file SearchWindow.mxml)

    " < = xmlns:mx mx:Window ' http://www.Adobe.com/2006/MXML "
    layout = "absolute".
    Width = "300".
    Height = "400".
    systemChrome = "none".
    minWidth = "300".
    Visible = "false".
    minHeight = "300".
    horizontalScrollPolicy = "off".
    verticalScrollPolicy = "off".
    creationComplete = "init (); »
    Closing = "Closing (Event)" "
    title = "My Title" >

    ...

    < / mx:Window >

    The window itself is created as a variable private in the application mxml:

    (in file MainApplication.mxml)

    public var searchWindow: SearchWindow = new SearchWindow();

    and once set (when the user logged), the closure of the login window

    [...]

    searchWindow.open (true);

    searchWindow.nativeWindow.visible = false;    do not show again

    [...]


    and open when the user clicks the search button:

    [...]

    searchWindow.activate ();

    searchWindow.orderToFront ();

    [...]

    (in file SearchWindow.mxml)

    the closing event handler looks like this (and the part which, as it seems to me, does not work)

    private void closing(event: Event): void {}
    Event.stopImmediatePropagation;
    event.stopPropagation ();
    Event.preventDefault ();
    save preferences
    this.nativeWindow.visible = false;
    var up: UserPreferences = Application.application.up;
    up.downloadCenter_downloadPath = downloadPath.nativePath;
    up.downloadCenter_width = nativeWindow.width;
    up.downloadCenter_height = nativeWindow.height;
    up.downloadCenter_x = nativeWindow.x;
    up.downloadCenter_y = nativeWindow.y;
    }

    As I said, what I'm trying to do is to hide the window, not close. It works on most systems, like mine (Windows 7). But this doesn't seem to work on some systems (in detail on 1 Windows XP, Unix 2 and 1 Mac system).

    What I am doing wrong? What is the correct way to achieve such a feature?

    Thanks in advance for any help!

    Hello

    Add below eventListener in the creationComplete of your main application...

    nativeWindow.addEventListener (Event.CLOSING, callClosing);

    Note the above event is Event.CLOSING but not Event.CLOSE...

    Event.CLOSING is called before that when the window is about to close... but Event.CLOSE is dispatcher just when he is about to close...

    and your close function should now look like to... as below:

    private void callClosing(event: Event): void {}
    Event.stopImmediatePropagation;
    event.stopPropagation ();
    Event.preventDefault ();
    save preferences
    stage.nativeWindow.visible = false;
    var up: UserPreferences = Application.application.up;
    up.downloadCenter_downloadPath = downloadPath.nativePath;
    up.downloadCenter_width = nativeWindow.width;
    up.downloadCenter_height = nativeWindow.height;
    up.downloadCenter_x = nativeWindow.x;
    up.downloadCenter_y = nativeWindow.y;
    }

    If this post answers your question or assistance, please mark it as such.

    Thank you

    Jean Claude Chari

  • How to back up data on the output of application?

    addEventListener (Event.EXITING, saveData); does seem to never have triggered and addEventListener (Event.DEACTIVATE, saveData); doesn't work sometimes. Someone at - he found a consistent way to detect if an application closes? Or better yet, when an application is reduced?

    You can use Event.CLOSING or Event.EXITING.  At least I get reliable events of both of them.

    If you do not, you listen to probably not on the objects on the right.  The following works for me:

    NativeApplication.nativeApplication.addEventListener(Event.EXITING, gotEvent);
    
    stage.nativeWindow.addEventListener(Event.CLOSING, gotEvent);
    

    Independent behavior of the App settings, both of these events arrive, in that order, after closing the application.

    Regarding the TOGGLE, it does not appear that we cannot rely on those to be an indication of whether or not the application is reduced.

    In window mode, our applications never do.

    In default mode, they deactivate only when another application is active.

    In pause mode, they work as much as them in the Simulator.

    Monitor more closely the State of your window, it seems, you can probably use the class IowWindow.  I plan to experiment with it, but personally, after our experience last few releases, I will be extremely careful when using the same things as that apparently described, but come with no guarantee that they'll still be autour, or what they are intended, etc..

  • Returning from universal theme item values - form Page (modal dialog box)-

    Hello

    I use the universal theme - modal dialog (the form page, page 7) and intend to return several values of the item to the page back 2 when the dialog box is closed.

    I'm back from the point values P7_DNAME & P7_DEPTNO of page 7 of the elements P2_DNAME & P2_DEPTNO on page 2 but does not work.

    Form Page - Page 7 (modal dialog box)

    Process - close dialogue

    Items to return - P7_DNAME, P7_DEPTNO (put several points of values here to go back to page 2)

    Report Page - Page 2 (that calls the page 7 of the modal dialog box)

    Here we have a dynamic Action. I use the event ""closed dialogue ' and 'Set value' action "

    Event (closed dialog box) -

    Action - set

    -Define (return goods of dialogue) - P7_DNAME, P7_DEPTNO Type

    -Selection Type (items) - P2_DNAME, P2_DEPTNO [here I am back to several items.]

    If I go back more than one Page values element, it doesn't any idea WHY?

    BUT if I'm back only a single value of point, there works perfectly well.

    Thank you

    Deepak

    You can return multiple items at once and their values are sent along, but you cannot set multiple items with different values by the action of a set value.

    You must create an action of the value set for each element you want to set the value with the value of the element to return.

  • Photoshop CS6 - eventSave reminder

    Hello world

    I'm developing my first plugin and I am facing a problem.

    I would like to export a file in a very specific format, each time I have save a PSD file, without having to save it in another step.

    The purpose of this file should be fed to another piece of software, but I don't want the user to deal with him, it should be transparent, as far as he is concerned.

    I need to read it in Photoshop, it is not a new file format.

    I thought that the best way to do this would be to create a plugin to Export.

    To make this work also, I created a second plugin responsible for recording the necessary reminder, essentially the eventSave callback.

    I have in my OnFileSaved method callback call export through a sPSActionControl-> Play call.

    This workflow works very well when I save a PSD file via a call "File/Save" or "file/save as.

    Unfortunately it does not work when I close a file not saved and respond Yes to the popup window "would you like to save the first file".

    The OnFileSaved function is called, but the sPSActionControl-> Play call will fail with a message indicating that the export function is not available.

    My understanding is that the file is probably already closed when the function is called and that Photoshop prevents me from doing anything because the resource is no longer available.

    My question to you is twofold:

    -you know a better way to do what I want to do?

    -is it possible to save a close callback, which would give me the opportunity to export my special file?

    Furthermore, I tried to save the reminder is triggered, in the hope of finding one that would return before the eventClose without success.

    Thanks in advance for your help :-)

    Sébastien

    1. Yes, I think it would be reasonable to get a backup event in this case but you get none. What you get instead is a close, with a path. Search for keySaving in the event closed; If his enumYes game (which implies that the document has been saved when closing), get the path by keyIn.

    Note that the path may be either a full path to the file or folder, if the file has been saved under the same name.

    2. Unfortuantely, there is no "before" in Photoshop event - you will only be informed of what is already happened, if I'm afraid all in 1) would you be notified on the file is indeed saved, you will not be able to play the export at this stage.

    There are various solutions I can think of this situation, but none of them are perfect. For example, you can inform the user and then automatically re - open the file he re-export and close, but it's a bit awkward and it will not work if the user closes Photoshop which is, of course, problematic (in fact, because of an ancient bug which I believe still exist in CC, can not show reliable third-party GUI when PS is closed). However, if your format is actually just a (relatively) lightweight metadata, you can cache in memory while the document is still alive, and then you will be able to save even when the document is closed.

    None of this is ideal, but at least I'm not up-to-date on a better way to process documents recorded-on-close.

  • Simple deletion of memory MC

    Hey guys, I have what seems like should be a simple way to add/remove a MovieClip memory.  My game has an intro animation MovieClip, the export value of the library.  I can't get this MC GC intro would be and I don't know why.  It adds only about 40 MBs to my use of the total memory.

    I have therefore 2 instances of Document class level:

    Curtain: curtains of var = new Curtains();  my MC Transition, moving between screens

    var currentScreen:MovieClip;  records everything that is the current screen.  Gets swapped when the user changes screens.

    When the user clicks a button in my main menu, I call a function in my Document class that adds a MovieClip (called "Curtain") transition to the screen. I pass this function the name of a function to call when the transition is complete animation. For example, when the user clicks on the button of my new game, one I call: "addTransition (loadIntro);"  Passing it the function to call when its done

    public void addTransition(callThisFunction:Function):void {}

    curtain.addEventListener ("closed", callThisFunction, false, 0, true);

    position and add curtains

    Curtain.x = stage.stageWidth *. 5;

    Curtain.y = stage.stageHeight *. 5;

    addChild (curtain);

    curtain.gotoAndPlay (2);

    }

    AddTransition function then sets up an event listener on the transition from 'curtain '.  This will call the loadIntro function when my MC curtain delivers the custom event 'closed' in his chronology.

    Done loadIntro what he would say, creates an instance of the Intro class (linked to the library) and adds to the screen.  Can I make a reference to the instance of class Intro ('currentScreen") to store in the world on the level of class.

    public void loadIntro(e:Event):void {}

    removeChild (currentScreen);

    Intro: Intro to var = new Intro();

    Intro.x = stage.stageWidth *. 5;

    Intro.y = stage.stageHeight *. 5;

    addChild (intro);

    curtain.removeEventListener ("closed", loadIntro);

    removeChild (curtain);

    currentScreen = intro;

    Intro = null;

    currentScreen.gotoAndPlay (2);

    currentScreen.addEventListener ("done intro", startTutorial, false, 0, true);

    }

    Now, when the user is watching (or jump) the introduction movie, the startTutorial function is called.   This function is SUPPOSED to remove the (stored in currentScreen) intro screen and memory.  Does not work.

    public void startTutorial(e:Event):void {}

    If (this.contains (currentScreen)) {}

    trace ("remove intro listener.");

    currentScreen.removeEventListener ("intro is", startTutorial);

    currentScreen.stop ();

    removeChild (currentScreen);

    currentScreen = null;

    trace (currentScreen);

    }

    curtain.removeEventListener ("closed", startTutorial);

    Add on top of all the other elements

    addChild (curtain);

    curtain.gotoAndPlay ("open");

    }

    I know it's a lot to take, so I'm very grateful for any help.  This is really a project that I paid 300 hours in.

    Thanks in advance

    As I said, it's all hearsay to me, but the fourth result in that search, I mentioned might have something to do with what you see.  The intro is might be big enough for the GC decides that it should not be discarded

  • Disable the main window close

    I have developed an AIR application and this is my goal, I don't want users able to close the main window. I tried to disable the close button but I thing that it is not possible. I would like to find a way to control which can be to trap the window closing event.

    Kind regards

    You can listen to the event Event.CLOSING and preventDefault on it, for example:

    http://ns.Adobe.com/MXML/2009.

    xmlns:s = "library://ns.adobe.com/flex/spark".

    creationComplete = "init ()" > "

    private function init (): void {}

    addEventListener (Event.CLOSING, cancelClose);

    }

    private void cancelClose(e:Event):void {}

    If (! allowClose.selected)

    e.preventDefault)

    }

    ]]>

  • How to detect the window closing event and to do some tasks before leaving

    Hello

    Someone knows how to detect the window closing event and to do some tasks before leaving?

    Sridhar

    Structure of the event allows to detect the window closing event. In the structure of the event,.

    Select this VI-> close round table for this task. See attached picture.

  • Error - the Intel PROSet/Wireless event log Service stopped working andwas closed

    Whenever I am re-booting, I get this error window:

    "Error - Service of Intel PROSet/Wireless event log stopped working andwas closed."

    It started a month ago. I can't tell at all what I did--except that I installed a router Linksys Cisco Wireless (802.11 N), replacing an old Netgear device (802.11 G).  My wireless feature works well and I really do not notice the effects to receive this error message.  I don't remember having this error immediately after installation of Linksys.  I "think" some time elapsed before the error started - but I don't re-boot often, so it could be related.

    I'm on Vista Ultimate OS, with Service Pack 2.

    Intel (R) Core (TM) 2 DUO CPU T9400

    Hello

    I was able to find a link from the site intel, where the question seems to be addressed, I recommend you to go through the link given below where a users seems to have found the solution.

    http://communities.Intel.com/message/69976

    Important note: this response contains a reference to third party World Wide Web site. Microsoft provides this information as a convenience to you. Microsoft does not control these sites and no has not tested any software or information found on these sites; Therefore, Microsoft cannot make any approach to quality, security or the ability of a software or information that are there. There are the dangers inherent in the use of any software found on the Internet, and Microsoft cautions you to make sure that you completely understand the risk before retrieving any software from the Internet.

    However you can make the boot which would help you to cut down on the service that is causing this problem.

    To perform a clean boot on a computer that is running Windows Vista, follow these steps.

    1. click on start, type msconfig in the search box and press ENTER.

    If you are prompted for an administrator password or a confirmation, type the password, or click on continue.

    2. in the general tab, click Selective startup.

    3. under Selective startup, clear the check box load startup items.

    4. click on the Services tab, select the hide all Microsoft Services check box, and then click Disable all.

    5. click on OK.

    6. When you are prompted, click on restart.

    7. after starting the computer, reinstall and run the program and see if the problem is resolved.

    Check if you have the same problem... If your issue is resolved, follow the how to determine what is causing the problem section in KB article to narrow down the exact source.

    http://support.Microsoft.com/kb/331796

    To restore your computer to a Normal startup mode, follow these steps.

    1. click on start in the box start the search.

    2. type msconfig and press ENTER.

    If you are prompted for an administrator password or a confirmation, type the password, or click on continue.

    3. click on the general tab.

    4. click on Normal Startup - load all device drivers and services and then click OK.

    5. When you are prompted, click on restart to restart the computer.

    Let us know if this helps

    Concerning
    Anthony.

  • My PC keeps closing automatically. A screenshot of the event log is attached. Help, please.

    It is not a correct stop either because when I start the PC again it will appear "Windows is not stopped correctly.

    -Event Viewer information and warnings are generally not what worry.

    They happen when something is not what window is expected, as not to use the default settings.

    Error and criticism in particular, are looking for. Errors are not always serious either.

    EG - if a software hangs or is closed after be minimized instead of being shutdown properly

    you will get an error from this event. Repeated errors are more likely to require attention.

    No matter what stop down or restarting is not done via the Start button > Shut down options is not a

    "clean" shutdown  Windows saves changes/information system when stopping down and this

    can only happen when there is a 'random', or intentional farm via the buttons on the case or the power switch.

    As a precaution, I generally try and restart Windows again properly when there was an involuntary stop to allow Windows to do what he did when stopping down via start > stop.

    -Material flaws is a potential cause of accidental closing or random reboot.  Inadequate or faulty power supply, hard drive, motherboard are all candidates.

    -Software conflicts and malware can also cause the crash or lock-up, but a stop would be

    not be common with software problems.

    More details what is happening, as well as specifications of the system including

    Watts and the power supply brand can help.

    If ' there are files on download on OneDrive the crash dump.

    Instructions can be found in the article troubleshooting BSOD - here -.

    There is also a link to Speccy, which may also be useful. With Speccy, use the option publish snapshot and post the link here. Note that Speccy gives details on everything except food.

    .

  • Keyboard - capture #issue opening/closing event

    Hello

    As off SDK 1.0.1 the method provided in this post is no longer works to capture the event of opening and closing of keyboard.

    http://supportforums.BlackBerry.com/T5/Tablet-OS-SDK-for-Adobe-AIR/is-there-is-a-way-to-capture-even...

    I looked at it, but so far has not found a good way. I was wondering if anyone knew a solution to capture when a keyboard opens or closes. To be clear: I don't want to force the keyboard to open/close, I just want to know when the keyboard appears or disappears. (the method in the included post just that)

    I need to know what I use the flash Textfield (and not TextInput due to the lack of support of what I need to do) and when a user closes the keyboard it does not lose the focus.

    Thank you

    Lol, I was just with my semi-automatic functions, I found the solution:

    If you link your textfield with the keyboard by using this:

    IMFConnection.imfConnection.setKeyboardOptions(yourTextfield, null);
    

    He will lose the focus if dismiss you the keyboard. If you capture the FocusEvent.FOCUS_OUT on the "yourTextfield" then you can do what you want in this function.

    Hope this helps some other institutions

  • Intercept the email opening and closing Email event.

    Hi all
    I created an app that does something, for example showing an alert when an email is opened or when enamel is closed. I am able to show the alert when I receive a call or hang up (via PhoneListener), but the problem is that I am not able to catch open the mail and close the event. I have no idea how this is possible. Please tell me if any APIs exist for this or any other means, it can be done.

    Collate MessageListener and MessageEvent.

  • How to listen to a closed screen event

    Hi, do achieve the example that I gave to 2 screens, I would class to know when App screen1 is closed and act at this time, how can I do this?

    import net.rim.device.api.ui.UiApplication;
    
    public class App extends UiApplication{
    
        public static void main(String[] args)    {        App  app = new App();        app.enterEventDispatcher();    }    public App()    {        pushScreen(new Screen1());        pushScreen (new Screen2());    }}
    

    Screen1.Java:

    import net.rim.device.api.ui.component.LabelField;import net.rim.device.api.ui.container.MainScreen;
    
    final class Screen1 extends MainScreen{
    
        public Screen1()    {        super();         setTitle(new LabelField("Screen1"));    }    public boolean onClose()    {     setDirty(false);      return super.onClose();    }
    
    }
    

    Screen2.Java:

    import net.rim.device.api.ui.component.LabelField;import net.rim.device.api.ui.container.MainScreen;
    
    final class Screen2 extends MainScreen{
    
        public Screen2()    {        super();         setTitle(new LabelField("Screen2"));    }    public boolean onClose()    {        setDirty(false);      return super.onClose();    }}
    

    Declare an interface:

    public interface ScreenClosedListener {
    
       public void notifyScreenClosed(MainScreen screen);
    
    }
    

    Add features to the Screen1 class.

    import net.rim.device.api.ui.component.LabelField;
    import net.rim.device.api.ui.container.MainScreen;
    
    final class Screen1 extends MainScreen {
    
        private ScreenClosedListener listener;
    
        public Screen1(ScreenClosedListener listener) {
            super();
            setTitle(new LabelField("Screen1"));
            this.listener = listener;
        }
    
        protected void onUndisplay() {       listener.notifyScreenClosed(this);    } 
    
        protected boolean onSavePrompt() {
          // if you want to always close the screen
          // without questions just return true
          // there is no need in setDirty(false)
          // in onClose() method
    
          return true;
        }
    }
    

    Add features to the App class, make the screen closed event listener

    import net.rim.device.api.ui.UiApplication;
    
    public class App extends UiApplication implements ScreenClosedListener {
           // compose Screen1 instance and pass to the constructor    // the reference to the App clas    // which is ScreenClosedListener implementation     private Screen1 screen1Instance = new Screen1(this); 
    
        public static void main(String[] args) {
            App  app = new App();
            app.enterEventDispatcher();
        }
    
        public App() {        pushScreen(screen1Instance);
            pushScreen (new Screen2());
        }
    
       public void notifyScreenClosed(MainScreen screen) {
    
             // check the event source object         if (screen==screen1Instance) {     // act accordingly here     }   }
    
    }
    

    }

Maybe you are looking for