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!

 
 
About The Author

Peter deHaan

Peter deHaan currently works for Adobe on the Flex SDK QA team. While not working on Flex, Flash, and ColdFusion applications, Peter enjoys making up bios and writing in 3rd person. Peter's rarely updated blog can be found at blogs.adobe.com/pdehaan/, actionscriptexamples.com, airexamples.com, and coldfusionexamples.com.

5 Responses to Publishing a release version of a Flex project

  1. stephan says:

    thank you!

  2. Aubweb says:

    Yes thank you very helpful !

    from 2800 kb to 2000kb.

  3. Eslam Ahmed says:

    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

  4. bilen cekic says:

    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

  5. Prateek Singhal says:

    Hey man,Thanks for the help………

Leave a Reply

Your email address will not be published.

You may 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