Adobe tools like Flash Builder allow you to compile actionscript sources of your application and then package all the swf content and assets as .air, .ipa, .apk and native package formats.
This post is meant to stress on the importance of using Release version of swf file for packaging when you intend to publish it on an application store.
Why should I care to create the release version of a swf?
There are two major advantages of using the release version for publishing applications:
- Application Size – The debug version of a swf contains lot of extra information which is required for debugging during development. As a result, the size of debug version of a swf is always more than the corresponding release version.
- Memory Size – Because of extra information, an application with debug swf consumes way more memory than its corresponding release version. For a sample Flex app, the memory usage can go down from 22 MB to 14 MB if one switches to using release version of swf.
- Application Performance – Some of the extra code embedded in a debug swf is actually executed during runtime, and so you might see performance gains with the release version of the swf.
If you are packaging your application for iOS, you would see some more improvements:
- Application Packaging Time – If you are using ‘Standard Packaging’ mode (which generates native ARM code for your swf content), the packaging time depends on the amount of byte code available in the swf file. As a result, you would most likely see a significant drop in packaging time if you use release version of a swf.
With release version of swf, the reduction in application size is also much more prominent while packaging application for iOS.
How can I create the release version of a swf?
There are two ways to do this:
- Use ‘Export Release Build’
This is the recommended way. In Flash Builder, select Project->Export Release Build, provide all the required information to package the application. This mechanism doesn’t actually put the release swf in some folder like ‘bin-release’, though it is actually packaged into the application package (.apk, .ipa etc.) file.
- Use Compiler option (-debug=false)
In Flash Builder, add “-debug=false” in Project->Properties->Flex Compiler->Additional compiler arguments, and build the application. With this compiler option provided, swf created with any configuration would always be the release version. Clicking on ‘Run” or “Debug” would however create this release swf in the “bin-debug” folder. You can use this compiler option (i.e -debug=false) even if you are using mxmlc compiler on command line.