How to exit a Flex app

I have a Flex application that is run in a browser.  There is a public page and then other pages that cannot be accessed unless the user logs in.  To log in, I show a popup window and the results of their username, password and role determines which page in a viewstack gets displayed.
My issue is this.  When the user clicks the logout button, I want the app to go back to the public page as if they just eneterd the application for the first time.  Is there are easy way to accomplish this, and is it secure?  If so, how?
Thanks again!

if you wanted to just close the window all together you could write some Javascript to close the window, then in your flex app call the function when they click the logout button
If you want to actually end it with Actionscript you could try:
public function applicationExit():void {
     var exitingEvent:Event = new Event(Event.EXITING, false, true);
     NativeApplication.nativeApplication.dispatchEvent(exitingEvent);
     if (!exitingEvent.isDefaultPrevented()) {
          NativeApplication.nativeApplication.exit();
Source: http://livedocs.adobe.com/flex/3/html/help.html?content=app_launch_1.html

Similar Messages

  • How to migrate a flex app from Flex Builder 3 to Flash Builder 4.7

    Hello,
    I have written an extensive application using Flex Builder 3. I have maintained the app for several years using FB3. In the mean time I have created several mobile apps using Flash Builder 4.7. So I am very familiar with the the new framework. However, my client has requested some big changes to the app. I figured this would be a great opportunity to migrate the app to FB4.7. I would like to keep the mx structure for the time being. So, are there any good documents concerning this migration path? What SDK should I use. Should I start using the Apache Flex SDK?
    Thanks,
    --randu

    Hello Raja,
    Thanks. Your reply has been very helpful.
    For deploying the Flex app, as a web on NW 04S, I did the following:
    - Created a web project and included the following files as web-content. These files were created using the Flex builder or in the Flex development perspective of NWDI - CE, you can find them in the "bin" folder of your Flex project.
       - AC_OETags.js
       - your-app.html
       - your-app.swf
       - history.htm
       - history.js
       - history.swf
       - playerProductInstall.swf
       - crossdomain.xml - This file is important, if our Flex app wants data from the server.
        ( I made the simplest possible crossdomain.xml containing
           <allow-access-from domain="*" secure = "false"/>
      -  Declare "your-app.htm" as the welcome file in web.xml
      -  Package, this .war after building this web project in an Enterprise application project and build it.
      Now, you have the .ear made, which is deployable on your NW Web AS.
    Apart from this, another thing which is important to be included in your Flex mxml code is the following:
    ( Thanks to Abesh for this........ )
    - You have to tell the Flex app, in the action script, as to from where should the Flash engine pick the crossdomain.xml ( in case you are accessing the server for data from your app)
    You might have noticed, we packaged the crossdomain.xml along with our other web content in the .war.
    So mention, something like this in your action script.
    Security.loadPolicyFile("http://<hostname>:<http-port>/<context-root fo your web app>/crossdomain.xml");
    The code will work like a charm.
    Hope this helps everyone.
    Thanks guys.
    Best Regards, Gagan.

  • How to Build a Flex App that works with both SQLite and MySQL?

    Let me explain a bit: I am developing an app that will
    be published as an AIR application using SQLite, as well as a FLEX application that will use MyDSQL via web services.
    I want to develop both applications in such a way that all the components can be reused, and I only have to do minimal redevelopment. I have started witht the AIR application. Once I have it completed, I want to publish the application (with minimal redevelopment) as a FLEX web app.
    My thinking is that I contain the database accesses in the Application, and passing the data via interfaces to the respective modules, as well as receiving data from the modules back to the Application to be written to the database. This was the only changes between the FLEX and the AIR application will be how the database access is handled in the Application file, and I can leave all modules as is and will be able to maximize reusability,
    I haven't done this before, and was wondering what the best approach for this is?
    Thanks!

    It seems very difficult to find best practices on how to structure your database layer in FLEX. None of the books I have go into detail about it, nor do any of the websites I have found so far, including the Adobe Flex tutorials. Sure, they explain how to interact with databases, but don't seem to care about best practices for structuring your application.
    Can anyone point me in the right direction for this?
    Thanks!

  • How to design a flex app so that it loads fast

    hi,
    i was gonna make a large CRM+ERP app in flex and was worried
    it would take a long time to load as even the smallest examples on
    various sites take quite a bit of time to load (quite a lot more
    than simple flash apps, why ??).
    i was thinking of breaking each component into individual swf
    but was afraid that it might make them pretty stand alone and not
    allow accesing their properties etc.
    what would be the simple and effective way to do this.
    can anyone point me to any large app developed in flex 2, i
    am also thinking of developing a Project Management app based on
    netoffice after this app. only if this gets developed succesfully
    coz macromedia used to have this great ability to make its flash
    look like the ultimate tool even when it had major short comings
    (one of them printing still exists in flex)
    thanks

    thanks man that was so much help. hope they update it for
    flex 2.
    also couple of queries.
    1.) does the form container carry the same overhead as other
    containers. (if not flex builder shud have stuff like auto layout
    and then when you are happy with layout you can set stuff to
    absolute layout and it auto fills widths, heights, x and y)
    2.) if i create components thru code as like in a for loop
    load time wud be same for 2 or 100 or 10000 components right.
    3.) another question similar to 2 is that if i dont use any
    outside controls load times shud be almost same for small app and
    large apps since all i am doing create instances of already
    existing control classes.
    4.) if i break down my app into components and then load them
    as needed wud it be same as creating each as a swf and loading
    them.
    5.) is layout using self written code faster than auto
    layout. (for simpler forms)
    6.) is creating controls via AS faster than creating them
    mxml.
    7.) is there any pauserefresh / pauselayout for when you want
    to add a lot of stuff and dont want to do auto refreshes.
    10x again for that link
    i will be posting my own research into optimizations in this
    thread too as i proceed with these apps

  • Flex Mobile: How to suspend a Flex app on Android

    Hi everyone,
    i need to suspend my app.The following code doesn't suspends it closes the app...
    NativeApplication.nativeApplication.exit();
    Is there acommand to just suspend the app?

    Im looking for a command which returns to the device homescreen/desktop and doesnt closes the app completly.
    I want the behaviour like if u press the hardware home-Button. The app still runs in the background and if u restart the app its in the state before u pressed the home button. In contrast if i use the code line posted above the app is really closed and doesn't runs in the background any longer.

  • How to debug 4.5.1 flex app in Black Berry play book?

    Hi ,
         i do want to know how to debug the 4.5.1 flex app in Blackberry playbook and the process  or do we need do enable any properties  plz let me help on this ASAP.
    Thanks

    Simeon,
    Thanks for that, I had a brainfart and forgot you can have the properties defined in that manner.  I changed it but it still wasn't working which made me realize I had to change the backgroundColor property on the view in Away3D.  I realized this after trying the params for the class and then not adding the view (which had a white bg) and then i looked at the docs and bam, there it was.  Thanks!
    Matt

  • How to implement Key Flex Fields in new oracle apps custom forms.

    how to impletement key flex fields in oracle apps custom forms
    if any technicle document is there then send me on this forum and also send me on my email id.
    [email protected]
    Thanks & Regards,
    Pranay Patel

    Hi,
    Please see the note:730068.1 - How To Invoke a DFF from a custom form
    Thanks,
    Ajikumar G

  • How to call Flex app from Javascript in portal question

    I've setup my flex 4 app with a callback function. The flex app is embedded in a Java portlet on a WebLogic Portal 10.3.2. How can I call the Flex app from the portlets javascript function? Code below shows how the flex app is embedded in the wrapper jsp.
    <script language="JavaScript" type="text/javascript">
            AC_FL_RunContent(
                        "src", "<%= srcPath %>",
                        "id", "<%= (String)request.getAttribute("portlet_name") %>",
                        "name", "<%= (String)request.getAttribute("portlet_name") %>", 
                        "width", "<%= request.getAttribute("width") %>",
                        "height", "<%= request.getAttribute("height") %>",
                        "align", "middle",
                        "quality", "high",
                        "FlashVars", "PORTLET_WS=<%= request.getAttribute("window_state")%><%= wsrpEncodedChannel %>",
                        "allowScriptAccess","sameDomain",
                        "type", "application/x-shockwave-flash",
                        "pluginspage", "http://www.adobe.com/go/getflashplayer");         
    </script>

    Thanks for the response. I followed the instructions in the link, but it does not appear to work within a Weblogic 10.3.2 portal. My Flex app is wrapped in a Java JSR 286 portlet. Should this approach work or is there a different approach for the portlets wrapper JavaScript to call a Flex callback function?
    thanks
    Dan

  • How to execute adobe air app & pass argument from Flex ?

    Helo everyone,
    May i ask a question, How to execute adobe air app & pass argument from Flex ?
    Thanks in advanced.
    Jacky Ho.

    Hello Jacky,
    You can find an example here
    http://spreadingfunkyness.com/passing-parameters-to-adobe-air-at-startup/

  • How CAn I Use a URL variable in Flex App

    Let say the link to a web page embedding a flex 2.0 app is
    http://www.myname.com?name=Bruce
    and I need to use the URL.name variable in the Flex app.
    How can I access URL parameters inside my Flex app?
    Bruce

    You probably know by now but I though maybe a could actualy
    answer someone question.
    {Application.application.parameters.name)
    put that in mx:text and you can see the var "name"

  • Flex Hero, how to make a whiteboard for Mobile Flex App in Android platform?

    I had made a whiteboard with the sdk 3.5 for PC, but when i use the same way in the SDK Hero, i can't draw any shape.
    I use a image to draw picture on it, and the   image.source   is   a  Sprite, and when i creat a new shape,  i add it in the Sprite,
    it is worked in the sdk 3.5, but it is not work in the Mobile Flex App.
    can anyone help me?
    Thanks  HamlinXu

    may be i know what happen,  i try to draw shape on  the view,not on the Image, it work.
    i think may be my image does not show on the view, but i have set the visible=true, it is stilll can't see the Image,
    how to make the Image can see in the view?

  • How to have HTML tags in Flex app wrapper.

    If I put this just below the <body> tag in my Flex app
    HTML wrapper, it displays:
    <h2>Greg Lafrance</h2>
    But if I put that tag just above the ending </body>, it
    does not show up.
    I'm sure it is something simple, but can someone please
    enlighten me?

    Hi,
    overflow property will tell the browser to hide the content
    if it is overflowing the available space. Please find more details
    at the URL below.
    http://www.w3schools.com/Css/pr_pos_overflow.asp
    IE is ignoring this style property and so we have scroll
    property for the BODY tag also. As Tracy mentioned, these are set
    to make sure Flex application occupies the browser.
    Hope this helps.

  • How to disable right-click in Flex app /w actionscript?

    Anyone know of actionscript code within Flex for disabling
    right-click. I've got an app that I don't want my users to have
    access to the right-click menu.

    "EvolvedDSM" <[email protected]> wrote in
    message
    news:gadm7g$fi6$[email protected]..
    > Thanks hanchan, I did just want to disable the zoom
    options and whatnot.
    > After
    > watching a few users, who have never worked with a flex
    app before,
    > accidentally right click here and there and zoom in or
    zoom out, I was
    > banging
    > my head on the wall thinking "this could happen ALL THE
    TIME with these
    > people".
    >
    > Ahhh, Amy. You need to feel the love of "No Script", a
    FireFox browser
    > extension. It is truly the best tool on the net imo. NO
    MORE ADS. You
    > have
    > to allow non-domain site ads to appear on the page, else
    they never load
    > and
    > you don't have to deal with the ads. If you use FireFox,
    get it!! And if
    > you
    > don't use FireFox, try it!!
    But even then, the player itself isn't providing you with any
    security.

  • File not Found Error in Flex APP-MDI

    Hi Friends,
    In my Flex APP-MDI application  have error.Th error is given blew.How can i solve this problem,please any one help to me.
    Error:
    File not found: file:/C:progmfiles/AdobeFlashBuilderBeta2/amdiBasicExample_1_1_1/bin-debug/amdiBasicExamp le.html
    Thanks,
    Magesh R.

    You would do better to ask this in the developer forum, not the user forum.

  • How do I close an app so that when I restart it, it doesn't just come back with the last screen, i.e. I want to be able to restart the app from new, not a follow-on

    How do I close an app/session, such that when I restart it, it doesn't come backat where I left off, e.g. Safari, I want to restart with a new screen, not the one I previously closed from
    Thanks

    Depending on how the app is programmed, generally to force close an app, double tap the home button. You'll see the app icons and previews on the screen. Scroll sideways if needed to bring up the app in question. Flick the preview for that app up and off the screen. then single tap the home button or the home page preview to exit the mode
    The app should then reboot from closed instead of just reopening

Maybe you are looking for