2 Replies Latest reply on Oct 6, 2009 12:05 PM by sbsb001

    New to AIR - want to use XML driven components

    sbsb001

      I'm completely new to the AIR publishing process (with Flash CS4). I have a couple of xml driven components I want incorporate into my project but I'm unsure of what I'm doing. I have gone through the help docs and done a few searches but I'm not understanding what I have to do or even if it is possible.

       

      My understanding is that the reference in AS3 (in the FLA) to load the XML file, has to be an absolute path. This isn't a problem on a web site but how does this get sorted when building a desktop app? ... which is what I want to do if possible. If this can be done then is this just a matter of adding the XML files into the list of files to be packaged?

       

      Sorry for the naive question/s but can anyone help?

        • 1. Re: New to AIR - want to use XML driven components
          Joe ... Ward Level 4

          If it is a static file, then you can add it to the package and access it relative to application install directory. If you will write to this file, however, you must copy it to another location because the application install directory is write-protected on some operating systems (namely Vista with UAC turned on).

           

          In the second case, it is recommended that you use the application-storage directory for files that your application uses. (For files that the user might use outside your app, like documents or pictures, you can use the documents directory). The AIR File class includes a number of static properties that give you the location of the typical set of well-known directories. You can use these constants to locate your files relative to the well-known directories in a cross-platform way.

           

          These direcories include:

          • File.applicationStorageDirectory—a storage directory unique to each installed AIR application
          • File.applicationDirectory—the read-only directory where the application is installed (along with any installed assets)
          • File.desktopDirectory—the user's desktop directory
          • File.documentsDirectory—the user's documents directory
          • File.userDirectory—the user directory

           

          (From: http://help.adobe.com/en_US/AS3LCR/Flash_10.0/flash/filesystem/File.html)

           

          Typically, you would include the XML file in the AIR package and copy it to a writable location when your application starts up (if it hasn't already done it earlier).

          • 2. Re: New to AIR - want to use XML driven components
            sbsb001 Level 1

            Thanks very much Joe, I've been hacking away at this for about a week now; much appreciated.