| Previous | Next |
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.
| Questions or Feedback? | Previous | Next |
- AS2 Migration
- Getting Started - Flash
- Debugging in Flash
- Building your application from inside Flash
- Getting Started - Flex
- Debugging in Flex
- Using mProjector - Compile Your SWF into an Appli
- Customizing The About Window
- Debugging Your Application
- Launching Application at Startup
- Mac vs. Windows Application Development
- Menus
- Dynamic Window Creation
- Application Basics
- mProjector Class Basics
- Add Remove Programs Control Panel
- Fullscreen and Center
- Check Connection and Download File
- Choose Files
- Creating an Installer
- Creating and Controlling Multiple Windows
- Cut, Copy, and Paste (Windows)
- Desktop Shortcut and Start Menu Support
- Drag and Drop Files
- Embedding HTML and other Media types
- Flash-Shaped Windows
- Message Box
- Open Documents
- Project Files
- Reading and Writing to Hard Drive
- Startup Application
- Wallpaper and Screensaver
- Window to Window Communications
- Working with Included Files
- Context Sensitive Menus
- Alert User
- Screen Resolution
