Skip navigation
Mahueles
Currently Being Moderated

How can I create an "exit" pop up in Flex Mobile?

Jul 23, 2013 10:27 AM

Tags: #skinnablepopupcontainer #flex #mobile #popup

Ok, I'm creating an app that has an "exit" button in all views, and when that button is clicked the only thing that I do is use "navigator.popToFirstView()", this works perfect, but I don't want people to exit right away, I want to have a pop up that asks if you are sure you want to exit, below is the code that I have for the skinnable pop up container:

 

<fx:Script>

                         <![CDATA[

                                             import mx.events.FlexEvent;

 

                  protected function yesExit(event:MouseEvent):void

                                             {

                                                            this.close();

                  }

 

                              ]]>

          </fx:Script>

 

          <s:VGroup>

                         <s:Label text="Are you sure you want to exit?" width="100%"  />

                         <s:HGroup width="100%" horizontalAlign="center" >

                                        <s:Button label="Yes" click="yesExit(event)" width="40%"  />

                                        <s:Button label="No" click="this.close()" width="40%"  />

                         </s:HGroup>

          </s:VGroup>

 

I tried using something like "parent.poptofirstview" but that doesn't work, and right now I'm stuck. Any help would be appreciated. thanks!

 
Replies
  • Currently Being Moderated
    Jul 24, 2013 6:40 PM   in reply to Mahueles

    You need to add an event listener for PopUpEvent.CLOSE on whatever view is creating the pop up.  Then in the handler for that listener, you can do a navigator.popToFirstView()  You'll also have to pass some type of data along with the close event so that you'll know whether the window was closed because "yes" was selected or "no".

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points