Some ways you can use Bime:

“Consulting: create dashboards for your customers to show them your findings”
How to compile a Flex project with RSL using Ant

How to compile a Flex project with RSL using Ant

View Comments

Recently, we had to write an Ant script to build our application and put it under continuous integration. At the beginning, we passed the minimum arguments to the compiler to build the SWF file and it compiled the project, including the framework classes, in the application SWF file.

  • Digg
  • del.icio.us
  • StumbleUpon
  • Technorati
  • Twitter

Recently, we had to write an Ant script to build our application and put it under continuous integration. At the beginning, we passed the minimum arguments to the compiler to build the SWF file and it compiled the project, including the framework classes, in the application SWF file.

So, how to use RSL winthin an ant script to reduce the size of the swf result file ?

Firs of all, you have to use a configuration file witch specifies a lots of information to the compiler about your application like the name, the player version, etc. So, you can create your own configuration file and specify all the informations needed. A sample of the file is in the flex sdk named “flex-config.xml”. Inside this file, you can write a tag runtime-shared-library-path witch specify the SWC file you want to use as an RSL.

An example of the config file may be:

<flex-config>
<compiler>
...
</compiler>

<runtime-shared-library-path>

<path-element>libs/framework.swc</path-element>

<rsl-url>framework_3.2.0.3958.swz</rsl-url>

<policy-file-url></policy-file-url>

<rsl-url>framework_3.2.0.3958.swf</rsl-url>

<policy-file-url></policy-file-url>

</runtime-shared-library-path>
...

</flex-config>

The <path-element> tag is the relative path to the library file, the <rsl-url> is the relative url of the RSL relatively to the root server path and the <policy-file-url> is the relative URL for the crossdomain.xml file. If not specify, flash will try to find it at the root of the server.

Now we can use this file in our ant task as a config file for the compiler. Therefore, the compiler will create correct links to the RSL in the project SWF file.

This is a sample how to use the config file:

<mxmlc file="..." >
...

<load-config filename="${basedir}/flex-config.xml"/>
...
</mxmlc>

After the build, the SWF file of the project is smaller than before and you have just to put the framework.swz and framework.swf file at the correct location on the server to use them as Runtime Shared Libraries !

Ready to try Bime? Take the free trial

  • Digg
  • del.icio.us
  • StumbleUpon
  • Technorati
  • Twitter

Author:  Yannick - Bime's developer and infrastructure manager


RSS Feed of We Are Cloud
  • Yannick Chaze

    [...] > How to compile a Flex project with RSL using Ant [...]

  • http://no.ne@eu dbam

    Any tags to include this function into ANT BUILD.XML file, without modding the flex-config?

blog comments powered by Disqus

Blog categories

Tags

bime business intelligence cloud computing corporate dashboard data analysis data visualization design event flex gartner google analytics optimization RIA saas salesforce security SMBs startup video