3 Replies Latest reply on May 5, 2009 4:50 AM by ATIF FAROOQ

    Save things in a ViewStack

    blwthompson-Js3DR6 Level 1



      Say i have a ViewStack with 3 buttons each button taking you to a different canvas on the same form. I would like these canvas' to be ediable by the user but also upon application close to automatically save what is within the canvas. Can anyone tell me how to do that??



        • 1. Re: Save things in a ViewStack
          Barna Biro Level 3

          Hi Brendan,


          Is this application Flex or AIR based? From what I know, you can't detect application close in the browser by using only ActionScript ( you need to read up on this, I think you can listen for the close with the help of Javascript but I'm not sure if you can pass the information to your Flex application on such a short notice ). If it's an AIR application then you can listen for application close and do the saving easily.


          Regarding the saving: you can either save the data the user has entered in a Database ( with the help of a server-side language like PHP or ASP.NET ), you could save it to the user's machine with SharedObject or with Flash Player 10 you should be able to write a file to the users PC ( just that I don't think you are allowed to write without he accepting... meaning that he'll have to press OK or something on a pop-up window ).


          If you could provide more details then I could give a more exact answer.


          With best regards,

          Barna Biro

          • 2. Re: Save things in a ViewStack
            blwthompson-Js3DR6 Level 1

            Hey Brian,


            It's an AIR application. And its 'sensitive' data, and there is no server side for the application either. So basically i want it to save it in EncryptedLocalStore or something. Would you be able to give some example code showing that as well as the detection of the close please??



            • 3. Re: Save things in a ViewStack
              ATIF FAROOQ Level 3


                 you can listen for close event in several ways in air


                NativeApplication.nativeApplication.addEventListener(Event.EXITING,onExititnEventHandler( event))


              or add closing event in your Windowed Application tag


              <mx:WindowedApplication xmlns:mx="http://www.adobe.com/2006/mxml"

              layout="absolute" width="860" closing="onExititnEventHandler"


              you can find information on storing data in ELS in the link below.


              http://www.adobe.com/cfusion/communityengine/index.cfm?event=showdetails&postId=10463&prod uctId=4&loc=en_US