Compiling

From MegaZine3

Jump to: navigation, search


There are multiple components of the engine that are compiled separately:

  • the engine core: megazine.swf
  • external elements: vid.swf and gif.swf
  • plugins: e.g. gallery.swf or navigationbar.swf
  • the preloader: preloader.swf

To compile a projector file (.exe / .app), see the tutorial "Building a projector".


Contents

[edit] How to compile

It is recommended components are compiled using the mxmlc compiler which is part of the free Adobe Flex 3 SDK. An Apache Ant build file (build.xml) can be found at the root level of each tag and the trunk itself. Once you have Ant up and running, you can just run it and it will compile everything in one go (except for the preloader, which has to be compiled using the Flash IDE, as it's a FLA file - reason is that vector graphics are used and it's much easier like this).

[edit] Setting up

[edit] Adobe Flex SDK

Get the Adobe Flex SDK containing mxmlc.

Unpack where you like. Unpack to C:/Program Files (x86)/Adobe/Flex 3 SDK or else adjust the path in the ant/build.properties file (property flex3dir) accordingly: in the build.properties you'll see one line beginning with flex3dir, adjust the path right to the = accordingly to where you extracted the SDK.

[edit] Apache Ant

Get Apache Ant.

You'll need Java to run Ant, so if you don't have it, get it now.

Windows users: you might have to add the bin folder of Java to the PATH environment variable. Have a google at how to set environment variables in Windows if you need help for that.

Extract Ant wherever you like and add Ant's bin folder to your PATH environment variable. Also create a environment variable named ANT_HOME and point it to the main folder (the one containing the bin folder and the other stuff).

[edit] Compiling

Now, open a command prompt, and change the directory to where you checked out the SVN tag or trunk. It contains a file named build.xml.

Enter ant, then press return to build everything.

Alternatively you can build specific parts only. Have a look at the ant/build.elements.xml and ant/build.plugins.xml files to find out the names of the targets. They follow a common pattern though:

  • engine: build.MegaZine3
  • elements: build.element.Name, e.g. build.element.Gif
  • plugins: build.plugin.Name, e.g. build.plugin.Gallery

To just build the NavigationBar plugin, for example, enter ant build.plugin.NavigationBar and press enter.

Use the publish target, to wrap things up, i.e. copy the compiled SWFs together with the other files necessary, such as localization and GUI file (from the assets folder) together into the publish folder. To do this, enter ant publish to also compile beforehand, ant publish.nocompile to skip compilation if you already did that anyway.

The resulting SWFs are put into the build folder.

[edit] OutOfMemoryError: PermGen space

When building everything in one go (which you'll do when just running ant or using the build or publish targets), you'll most likely run into this error. To work around it you'll have to increase the maximum allowed memory used by ant and it's tasks.

Note: Not sure what the minimum required memory is, but this works, so I didn't bother testing anything lower.
Personal tools