6 Replies Latest reply: Dec 1, 2006 4:41 AM by leeais RSS

    Question about storing history

      Hello, im having trouble with storing data to the cell phone.
      im try to figure out how to use fscommand2 SET and GET methods but could not find any reference :(
      what im trying to make is a home page for cell phone where the page display different contents randomly. i only try to store some kind of reference number to avoid displaying same content continuously. can anyone give me some tips please?

        • 1. Re: Question about storing history
          mitsimatt Community Member
          hey taiga,

          what you need is a shared Object,
          this will create a reference file for you on the handset, and will remain saved after the aplication is closed.

          there is a reference file for this is the CDK

          • 2. Re: Question about storing history
            taiga_umeda Community Member
            hi Matt.

            thanks for your comment,
            i came across the sharedobject too.. looked at many references but still having a difficulty of using it... do i have to use adapter thingy?...
            ill probably look at CDK tmr and have another try....

            • 3. Re: Question about storing history
              mitsimatt Community Member
              my (limited) understanding of the shared object is the following

              1st, create the object, lets say :

              var myRef_SO:SharedObject;

              then add data to it as normal.

              when you are ready to save the data to the device, you would use


              it's always a good idea to attach this to the exit command also, so data is saved on leaving the application...

              this could also be done within a conditional statement if you want to check for existing data.

              probaly best looking over the information within the flash help files to get a much more detailed (and probaly accurate :) ) explaination.

              hope that helps

              • 4. Re: Question about storing history
                taiga_umeda Community Member
                thanks again matt, i tried the approach you mentioned above.

                var so:SharedObject;
                so = SharedObject.getLocal("so");
                so.path = this;
                if(so.data.history == undefined){
                index = Math.round(Math.random()*10-0.5);
                so.data.history = index;
                var status = so.flush();

                how do i access the contents i write? and also the status from flush() outputs false somehow :( i put those codes in constructor ..does this matter? i looked at the samples but they are slightly different and having difficulty of modifying it...sigh

                • 5. Re: Question about storing history
                  taiga_umeda Community Member
                  ok i think i got some idea of how it works... because of shared object in device is not synchronized...i had to access shared object from function passed to listener...
                  is there anyway i can pass some variables to the listener function???
                  • 6. Re: Question about storing history
                    Interesting... does this work in flashlite 1.1?
                    I'd like to use flashlite 1.1 to store data on the phone but i dont know what the best way, if any, would be?
                    Any help is appreciated.