2 Replies Latest reply on Aug 10, 2011 7:12 AM by s_davies

    Reset application on startup


      I mentioned thi sbefore but probably in the wrong way so here goes.


      When testing my application on an android and ipad, everythign is ok, but when I sya, close the app down via pressing the home button on the ipad/android, then when I press my app to open it again, it remains on the last screen it was clsoed on.


      Is there a way in which i can make my app load the first page or loading screen each time its reopened, so the user is taken to the beginning each time.


      Hope this makes sense


        • 1. Re: Reset application on startup
          Rangora Level 3

          In your application.mxml, listen to the creationComplete event and add this code :


          protected function app_creationCompleteHandler(event:FlexEvent):void
                    NativeApplication.nativeApplication.addEventListener(Event.DEACTIVATE, returnToFirstView);
          public function returnToFirstView(event:Event):void


          But beware... If your app is deactivated because you use the CameraUI or the CameraRoll (for example), the event will be fired.... in this case you would have to add a mechanism to prevent the effect (set a static boolean would work).

          • 2. Re: Reset application on startup
            s_davies Level 1

            Thanks, that seemed to work.


            On android it resets on closure andon the iPad it resets when the app is re opened.