Discussion Area

ask questions, discuss topics, solve problems

This is a public Discussion Area  publicRSS

Thread

    • Save data locally in AIR
      Thread posted 12/30/08 by Paolo Carraro EKR
      668 Views, 1 Comment
      Title:
      Save data locally in AIR
      Content:

      Hi folks! i just open my blog and writing my first pos, linking a useful flexer post (http://www.flexer.info/2007/10/25/deep-object-copy/) i found this group... so my first post it's also a question... if you want take a look any comments it's appreciated!

      www.ekr.it/PC/blog

      Bye

    Comments

    • Hi,

      First of all sorry for the late reply. Looking at the code I see some things that may cause it (I did not try it):

      1) The file does not have a name. That may not cause problems in itself but can cause problems in the future. Looking at Adobe docs:

      var prefsFile:File = File.applicationStorageDirectory;
      prefsFile = prefsFile.resolvePath("preferences.xml");
      


      You can pass null to the File constructor but then assign File.desktopDirectory (or other value) to the File object.

      So either:

      var file:File = new File("app-storage:/preferences.xml")
      

      or

      var file:File = File.applicationStorageDirectory.resolvePath("preferences.xml");
      


      [taken from Help:File]

      2) the garbage collector shoud not cause problems (if you have a reference to the object then it will not be garbage collected)

      3) I remember I had some problems with ObjectUtil.compare at some point (2 identical objects were reported as not identical). I think it was due to the complex nature of the objects. I solved it by creating my own compare function:

      if obj1.len == obj21.len
          for i=0,obj1.len i++
              if obj1[i] != obj2[i]
                  ret false
              ret true
          ret false