next up previous contents
Next: Add more functions to Up: Tutorials Previous: Tutorials   Contents

Converting your flash movies to an executable program

In this tutorial you will learn how to create a simple SWFKit project to convert your flash movies to an executable program(.exe file). If you have a flash project, say, a flash presentation or a flash game, which may contain more than one flash movie(.swf file) in several folders, with many other resource files such as XML files, sounds, images, text files, etc, and you would like to convert them all to a single .exe file, or an .exe file that can launch and play your flash presentation or flash game, you can do as follows.

The first step is to launch SWFKit (either SWFKit Express, SWFKit or SWFKit Pro) and create a new SWFKit project. After saving your new SWFKit project, you can then set the "output details" options such as the output directory, what to build, an .exe file or a .scr file(the default setting is to build an application, that is, to build an .exe file), the icons for the output .exe file or .scr file, etc, as shown in figure 1.1

Figure 1.1: Creating a new SWFKit project
Image t9

If you check the "standalone" option, SWFKit will pack the Flash Player into the output .exe file so that it can work on a computer without the most current version of Flash Player, or without Flash Player at all. The "Create AutoRun.inf" enables your project to create an autorun.inf file, that is, your project can produce an autorun CD. If the "pack resources" option is checked, SWFKit will produce a single .exe file, that is, all the resource files are packed into the output .exe file.

Now you can begin the second step - adding resource files into your SWFKit project. Going to the resources panel, you will see a tree view on the left side of the panel and a list view on the right side of the panel, as shown in the figure1.1. The tree view is used to organize the directory structure of the resource files, and the list view is used to manage the resource files in a folder. Typically your resource files are added into the "Application" folder in the tree view, and the "Windows" folder is only used by the installers to copy some special files to the Windows folder or system folder. The simplest way to add your resource files is to use the "Import" button. In this way, all files in your flash project will be added into the "Application" folder and the directory structure of your flash project keeps unchanged. You can also add your resource files by creating folders and adding files manually. The resource files can be of any file type. After adding the resource files you must specify the main movie, which is the flash movie that the output .exe file will load first. You may notice that before each file in the list view there is a check box. It is used to protect your resource files. You may read the relative tutorials to learn how to use it.

Figure 1.2: Adding resource files
Image t10

The third step is to go to the "Application Definition" panel to set the options such as appearance, size, position, behavior, etc of your output .exe file. For example, in this panel you can set the caption of the main window of your output program, check the "show in system tray" option to show an icon in the system tray, define the exit keys, etc. See figure 1.1

Figure 1.3: Settings of your SWFKit project
Image t11

Finally, you would have to insert a line of code into the "initialize" script as follows,

//Initialize
getAdditionalFile();

return true;
The purpose of calling the "getAdditionalFile" method in the "initialize" script is to extract the resource files if they are packed into the output .exe file, or the output .exe file cannot work properly. Now your SWFKit project is ready to work. Before building the output .exe file, you can preview it first by pressing the hot key "F9" (for screen savers it is "CTRL+F9"), and in this case SWFKit does not produce any .exe files. When you feel everything is ok, you can build the output .exe file by pressing "F7" and run it by pressing "F5". To go to the directory that the output .exe file resides in, you can press "F10".

From what have been discussed above, you can see that it is very easy to convert your flash project to an .exe file - just some mouse clicks.


next up previous contents
Next: Add more functions to Up: Tutorials Previous: Tutorials   Contents
Copyright ©2000-2010 Shanghai TopCMM Software Technologies. All Rights Reserved.