Creating an Installer for Your Application

This sample shows how to create an installer using Flash, ActionScript, and mProjector. This application installs the Red Ball and it's ReadMe file.

The installer is meant to be a single file installer. Add the Red Ball application and ReadMe.txt files to the installer app using mProjector's "Add File" tab.

The installer calls mSystem.getSpecialFolder() and mFile.copyFile() to copy the "Added" files to the Windows Program Files folder or the Mac Applications folder. On the PC the installer adds Red Ball and ReadMe to the Start Menu using mFile.createShortcut().

When the installation is finished, the installer creates a Desktop shortcut for Red Ball using mSystem.getSpecialFolder() and mFile.createShortcut(), launches Red Ball using mSystem.executeApplication(), and opens the ReadMe.txt file using mApplication.openDocument().

Creating a good installer is a bit more complicated than I expected ;-). I tried to make this code flexible and this is a good start.

To use this code for your project change the "Use Specific Constants" in ActionScript below and modify the interface to match the look and feel you require.

If you need to do something more elaborate, most of the action occurs in Frame 2. This installer works it's way through the installation using the following states.

  • "prepare" -- Prepares the installation. Looks for a existing files and confirms the user wants to overwrite them and begin the install.
  • "deleting" -- Deletes files from a previous OR the current installation. If the user aborts installation files installed thus far by the current installation.
  • "installing" -- Installs the files and adds Windows Start Menu items.
  • "complete" -- Installing files is complete.
  • "abort" -- User has requested that the install be aborted. This state occurs if the user decides not to delete a previous install or clicks the "Cancel" button during the install. If the abort occurs during "installing" state, all the files thus far are removed.
  • "aborted" -- After the abort activity is completed.
  • "error" -- After a fatal error has occurred durring installation.
  • "pause" -- Installation is paused while the user is asked a question. When a previous installation is found the user is asked whether or not to delete these files and continue. If the user responds with a "Yes" the installation process is continued. If not the install is aborted. When the "Cancel" button is clicked the user is asked if the installation should be aborted. If the user repond with a "Yes" the installation process is aborted. If "No", the installation is "resumed".
  • "resume" -- The installation is resumed when the user confirms that the existing files should be deleted.

You can download this sample, "Red Ball Installer", from the mProjector Samples page -- /software/flash-projector/flas.html#installer.

levitra 20mg bestellen cialis in holland kaufen