March 20, 2007
OK, last warning. Tonight is the Indy Flex user group meeting.
Please join me at the Indianapolis Flex User Group on Tuesday March 20th, 6:30 PM
Location:
LANTech Training
The Pyramids,
3500 DePauw Blvd.
Pyramid 3, Floor 2
Indianapolis, IN 46268
P.S.: If there is time, maybe I can show off some Apollo stuff.
Leave a Comment » |
Announcements, IndyFlex |
Permalink
Posted by everythingflex
March 20, 2007
One of the beauties of Apollo is the ability of the application to update itself whenever necessary. Those of us who are used to the client/server metaphor have never had to worry about this because if we found a bug in our code (yeah right), we could simply update the server and it is like it never even happened. However, now that we are offering our applications for download, we lose a certain piece of control. Unless, we build in a method for our applications to update themselves when necessary.
This example shows one method for doing this. Here is how it works.
- I set a variable to hold the current version number (It would be nice if we could simply read the version number from the -app.xml file but I don’t see a way to easily do this with the current alpha)
- I have setup an xml file on my server to store the latest version number and file name which is called via HTTPService. Here is what the XML file looks like:
<?xml version=”1.0″ encoding=”ISO-8859-1″?>
<latestVersion>.4</latestVersion>
<latestFileName>SelfUpdating04.air</latestFileName>
- After calling the HTTPService, I compare the currentVersion to the latestVersion and Alert the user.
- If the user asks for the update I retrieve it via the URLSteam, which then calls methods to write the AIR file to disk.
- Finally, I call the Updater update method which installs the new version and restarts the application.
Here are some screen shots and links to download the outdated version of the application and source code.
Version .3 loads:

User clicks “Check for Update”

After choosing “Yes” new version downloads and installs (Wow what an upgrade!!)

Finally, the user clicks “Check for Updates” again

NOTE: Please do not run this over and over again or you will suck up all of my bandwidth. You can easily replicate this on your own servers.
Also, this application puts the control in the users hands, but you can also do all of this automatically by checking the version on creationComplete and then installing the new version automatically without user interaction.
Download the Application
Download the Source Code
3 Comments |
Apollo, Tutorials |
Permalink
Posted by everythingflex