I never thought development of web games can be that simple until I started development of my first game with Adobe Flex. I made two games, without any prior experience with Action script, in only ten months: "Fitter" and "RGB".

I found many answers to my questions on different forums and web sites, and it is time to share my knowledge with Flex community.

Thursday, November 5, 2009

Compiling and running

Compilation process creates object files from source code and builds them together with content files (sounds, images...) into executable SWF file. In chapter 2 - Setting up project environment you can find build scripts for Windows and Linux with instructions how to execute build process. If you didn't follow the tutorial, you can download package with all files made so far.

Compile

If you have all necessary files in project root directory (two source files and one build script), execute command make.bat on Windows or make on Linux. If all goes well, Flex compiler will report location and size of output file (SnakesAdventure.swf) after few seconds.

One advice for developers on Linux: when you make changes in source and content files and then try to recompile, compiler refuses and reports:

make: Nothing to be done for `all'
Compiler did not find any changes in source code (if you did not change SnakesAdventure.mxml) and assumes that existing SWF file is up-to-date. Execute make clean, to remove existing SWF file, before make.

Run

If you have SWF files associated with external application on your system, you can run SnakesAdventure.swf from file system browser. If not, you can run the SWF file with Flash player. Flash players for different systems can be found inside runtimes/player folders inside Flex SDK. Start Flash player, choose the Open option from File menu and select location of file SnakesAdventure.swf.

You can also run SnakesAdventure.swf from your Internet browser, just make sure it has required Flash plug-in installed. You can enter the location of SWF file in navigation bar or select it with File/Open File option.

When application starts, you will see an empty black frame. Black background colour was specified with backgroundColor attribute of mx:Application tag in SnakesAdventure.mxml. #000000 value represents black colour. If you would like to experiment with backgroundColor attribute, you can find more info about HTML colours here.

Now that we have project set up and we can compile and run the application, it is time to focus on development of game itself.

No comments:

Post a Comment