We've occasionally come across situations where we want to pack up our Flash projects as single executable files - not installers! - that can be run on the desktop without needing to be installed. This is like just creating and running a Flash projector.exe - however, our projects generally consist of more than one file, and packing them up as a single projector is impossible. We've also hit this when using the Flash wrapper SWHX, which depends on a lot of external files.
Our solution is to use the install script creator NSIS to create a single silent installer; when run, the installer simply silently unpacks all the files contained within it into a folder in the user's TEMP folder and runs a specified executable.
Here's a sample script that does the job:
; NSIS script to package up all the files in the current ; folder - when the resulting .exe is run, ; all the files are unpacked into a temporary folder ; and a projector file is run. ; ; by Ian Thomas at Awen, 2006 ; ; ------------------------------------- ; IMPORTANT: Place the name of your resulting app - ; i.e. the one the user will click on - here: OutFile "MyApp.exe" ; IMPORTANT: The icon file to use for your output app Icon "app.ico" SilentInstall silent SetCompress Off RequestExecutionLevel user Section ; Generate a temp file name GetTempFileName $0 ; Delete it and replace it with a folder Delete $0 CreateDirectory $0 ; Report any problem IFErrors 0 +2 Abort "Can't create temp folder! Please contact support." ; Unpack files SetOutPath $0 ; Pack all the files in the current directory and its subdirectories, ; excluding anything in SVN File /r /x .svn "*.*" ; Run the executable and wait ClearErrors SetOutPath "$0\" ; IMPORTANT: Place the name of your starting executable (i.e. the file to run ; when unpacked) here. ExecWait "myprojector.exe" IFErrors 0 +2 Abort "Can't run app! Please contact support." ; And delete the unpacked files ClearErrors SetOutPath $TEMP ; Need to do this because we can't delete the working folder RMDir /r $0 ; If there's an error we probably don't really care, as it's in a temp folder SectionEnd