3 Replies Latest reply on Aug 24, 2011 10:15 AM by aditya206

    Flex Compile Issue


      Hi All,

            I have been struggling with this since last 2 days. It's very urgent as we are going to production next week and I need to fix it as soon as possible.


                My problem is, I have developed a Flex App which would talk to the Java based Tomcat Server. When I use the Flash Builder 4 Premium built swf file(manula copy to Tomcat webapps folder), it appears to work just fine with out any issues. But when I use the war built using Ant or Maven, the generated swf file seems to hang immediatly once its loaded with busy clock cursor. I checked FlashFireBug for any errors, with no luck.


           I compared the swf files generated by FlashBuilder4 & Ant scripts. There is a huge difference in file size (FlashBuider built file size 1,381,781  bytes & Ant built file size 590,339  bytes). Decompiled these files using SWF Decompiler and saw the difference to be in the Misc Tags( Flash Swf has 634 files in this folder while ant swf has only 17 files). Most of these 634 files being DoABC 0. I really dont kow what these things are adn assuming does it have to do some dependencies.

      Flash BUilt Swf.PNG


      Also, i am attaching the Ant script  I have used..


      <project name="Flex Ant Tasks Build Script" default="compile flex project">
          <!-- load previously defined configuration properties file -->
           <property name="FLEX_HOME" value="C:\Adobe Flash Builder 4.5\sdks\4.5.1"/>
          <property name="SRC_DIR" value="${basedir}/src"/>
          <property name="DEPLOY_DIR" value="${basedir}/../../WebApp/SlingDashboardWeb/src/main/webapp/flex"/>
          <!-- points to our flexTasks.jar we copied to the libs folder to distribute with the project -->
          <taskdef resource="flexTasks.tasks" classpath="C:\Adobe Flash Builder 4.5\sdks\4.5.1\ant\lib\flexTasks.jar"/>
          <!-- delete and create the DEPLOY dir again -->
          <target name="init">
              <delete dir="${DEPLOY_DIR}/MyProject.swf" />
          <!-- Build and output the Main.swf-->
          <target name="compile flex project" depends="init">
                  <load-config filename="${FLEX_HOME}/frameworks/flex-config.xml"/>
                  <source-path path-element="${FLEX_HOME}/frameworks"/>
                   <application-domain path-element="libs/custom1.swc" application-domain-target="top-level"/>
                  <compiler.source-path path-element="${SRC_DIR}" />
                  <compiler.source-path path-element="${basedir}/actionscript" />
                  <compiler.library-path dir="${SRC_DIR}" append="true">
                      <include name="libs" />



      Any kind of help is greatly appreciated. Thank you in advance.


      - Aditya206

        • 1. Re: Flex Compile Issue

          Hoe Flex builder 4 is buildign your project .. verify here  project->properties->FlexbuildPath , select libraryPath tag, verify how is it building -- RSL or merged in code?

          I guess it's RSL, and flex builder 4 will have small swf but more number of files generated in output folder and main SWF is able to find these dependecies.


          In case of your ANT script, u have specified (-static-rsls=true which means RSL linkage turned off --in this case libraries used as RSLs must be put on the external  library path (-external-library-path).

          • 2. Re: Flex Compile Issue
            aditya206 Level 1


               Thanks for the response. Flash Builder is using the "merged in code" , I was able to fix the size issue by adding the RSL's through


                           <runtime-shared-library-path path-element="$/frameworks/libs/framework.swc">                             <url rsl-url="framework_4.5.1.21328.swz"/>                             <url rsl-url="framework_4.5.1.21328.swf"/>                  </runtime-shared-library-path>                 <runtime-shared-library-path path-element="$/frameworks/libs/rpc.swc">



            I am using Spring with BlazeDS in my project. Now the issue is, I am seeing request send trace of the Async request from Flex which is built using Ant scripts, but don’t see any request reaching the server. I have added rpc RSL. I don’t understand whatelse I am missing in the RSL's. When I use the Flash built swf, everything seems to works fine.


            I am newbie in the Flex world and trying to swim through it.

            Thanks again for responding.

            • 3. Re: Flex Compile Issue
              aditya206 Level 1

              Hi All,

                       I finally could fix the issue. For those who had this of kind of issue, these are the steps I did to solve it.


              1) I maded sure the ant build is picking up the RSL using the tag


                             <runtime-shared-library-path path-element="${FLEX_HOME}/frameworks/libs/framework.swc">
                                       <url rsl-url="framework_4.5.1.21328.swz"/>
                                       <url rsl-url="framework_4.5.1.21328.swf"/>


              2) Added the services argument to the build so that it can connect to remote objects


                           context-root = "MyProject"


              In my case, I was missing the service argument because of which I was getting a fault response.


              Thanks again guys, I love this forum.