5 Replies Latest reply on Dec 16, 2008 2:26 PM by Joe ... Ward

    Updating application and data files seperately

      I'm creating an app that comes with about 100 MB of video files. I anticipate these videos being updated rarely, if ever. The application itself may be updated fairly often. Ideally I could update just the app itself - maybe 1 MB - without requiring the user to redownload 100 MB of video files every time.

      Is there an easy way to do this?

      All suggestions are appreciated.
        • 1. Re: Updating application and data files seperately
          Sure is. It's easy, but detailed... You'll need to create separate processes for updating the app and updating data.

          For updating the app, you can use something like this:

          var updater:Updater = new Updater();
          var airFile:File = File.documentsDirectory.resolvePath(YOUR_FILE);
          var version:String = YOUR_VERSION;
          updater.update(airFile, version);

          For updating video files (your data), here's what I do:

          1. Download an XML file with the URL's of each of the files on the server.
          2. Parse the XML file and push the URL's to an Array.
          3. Once the last URL has been pushed to the Array, I call a function that creates a URLLoader for the first element (file URL) in the Array and add a listener for the COMPLETE event so that when that file finishes I can remove the downloaded URL from the Array and call the download function again.

          This way all your files come down sequentially, neat and tidy... And if there's a broken download (if you've set up markers locally) you'll know where the download has to resume.

          Hope this helps.

          Sorry I couldn't put very much code up. Our app is actually very big with lots of sub-processes in between the steps I've outlined so it would probably be a bit confusing.....Also we have an NDA w/ the client to there's only so much I can show.
          • 2. Re: Updating application and data files seperately
            BhaskerChari Level 4
            Hi I am also building an application similar to this.
            Actually I am building an application which downloads all the media files from the server(includes both video and images) after the download is complete. I will start the slide show of the downloaded media files.

            ow my problem is I have to download all the media files once in a day at a particular time on a day from the server(The time is set in backend).

            I can acheive this by running a process and connecting to a server. But if I close the application window how the process can run and how it can download media files from the server daily.

            Is there a way so that I can create two applications one for downloading the media files from the server which runs always and runs in the background. Another one is my main application which displays the media files that are downloaded and saved in the local filesystem.

            All suggestions are appreciated.


            • 3. Re: Updating application and data files seperately
              Hi BhaskerChari, I am creating a suite of applications for constructing e-Learning and it would be nice to have a overall management application that is constantly running in the background. I've noticed that a few Air Apps (especially those from Adobe like Adobe Media Centre) run in the systems tray. This may prove a route for a possible solution?
              • 4. Re: Updating application and data files seperately
                I have the same situation. But I have a basic question relating to this. We currently have a flash application, and we simply update the .swf file and place it into the directory that has all our assets (video clips, images, etc). Now we need to run as AIR, to access local files. Can we simply convert our application to an AIR app, and install it to this same directory, where it can find all its content? I tried to do this, with no luck (might have done it wrong tho ..) I do not want to have to include all this content in the AIR application.
                • 5. Re: Updating application and data files seperately
                  Joe ... Ward Level 4
                  @charliePeet You wouldn't do it exactly the same way. The best way is probably to install the AIR application (without all the assets) and then either have the application download and store the assets in the application storage directory or add a mechanism to tell the application where to find the assets on the local computer.

                  Note that the application directory (where the application is installed) is often write-only (depending on the OS and the user's permissions). It is NOT a good place to put resources that aren't included in the AIR installation package. Use the application storage, documents, or a user-selected directory for that.