Publishing a release version of a Flex project

by Peter deHaan on October 20, 2007

in Export Release Version, Flex Builder 3, View Source, beta

In Flex 3 Beta 2, the default application publishing behavior changed slightly. Now, by default a debug version of your Flex application will be generated when you select Run or Debug. Due to the file size differences between a debug and release version of a SWF file, you’d never want to deploy a debug version of a SWF into a production environment.

For example, consider the following simple, yet rediculous example:

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
        layout="absolute">

    <mx:String id="str" />

    <mx:DataGrid />
    <mx:List />
    <mx:Button />
    <mx:Accordion />
    <mx:TileList />
    <mx:Panel />
    <mx:HSlider />
    <mx:TextArea />
    <mx:TabBar />
    <mx:Label text="{str}" />

</mx:Application>

If you select Run > Run from the main menu, the file size of the generated SWF file is roughly 490 KB. By exporting a release version of the same project, the SWF size drops conderably down to roughly 300 KB (saving you about 190 KB, or 39% file size).

This is all good in theory, but how do you export a release version of a SWF, you may be asking yourself. Why, simply select Project > Export Release Version from the main menu. Flex Builder brings up the Export Release Version dialog box which lets you specify a path where the optimized release version SWF/HTML/JavaScript files are located (you may or may not see all these files depending on what settings you specified in the project properties Flex Compiler settings). By default the release version of the files will be located in a /bin-release/ folder. If you want to enable the right-click view source option for your Flex application, select the Enable view source check box and optionally select which source files will be included. When you are finished with the Export Release Version dialog box, simply click Finish and Flex Builder will generate/copy all the files based on your project settings. Simply navigate to the project folder on your hard drive and copy/upload the desired files to the server.

Congratulations, you just deployed a release version of a Flex app!

{ 4 comments… read them below or add one }

1 stephan February 7, 2008 at 11:26 am

thank you!

Reply

2 Aubweb February 15, 2008 at 12:31 am

Yes thank you very helpful !

from 2800 kb to 2000kb.

Reply

3 Eslam Ahmed June 23, 2009 at 12:57 am

hi, i did it exactly but i have a problem here i don’t know why .. i released aversion of my application which is connecting to database to edit or delete ,… but when i released aversion with extension .air it doesn’t work although it works when i run it in flex … please feedback as soon as possible …thanks

Reply

4 bilen cekic September 10, 2009 at 3:23 am

hi,
i have a problem which is similar to eslam ahmed’s.
Webservices works fine on local, but when release and upload to server, they don’t work. why?
pls help

Reply

Leave a Comment

Sorry, this blog is terrible at eating HTML comments.
If you're pasting any HTML/XML/MXML code, you need to convert your < characters to &lt; and your > characters to &gt; .

You can use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="">

Anti-Spam Protection by WP-SpamFree

Previous post:

Next post: