« How to reduce the size of any flex app using RSL
» Cast to int issue

Flex 2, Flex resources, RIA

RSL further details

08.01.08 | 1 Comment

As I have played with RSLs more I saw something surprising: If I compile the swc into a swf the resulting swf is bigger (almost twice) as it should have been. When you use compc to create a SWC, the SWF inside the SWC contains a lot of unnecessary stuff when used as an RSL. That stuff is necessary to create an application which uses the SWC, so don’t go ditching compc. Here is what you need to do if you want to have size optimized RSLs:

  1. Create an actionscript class that extends sprite and include in it references to the stuff you want to go in the RSL:
    package
    {
      import flash.display.Sprite;
      import mx.core.Application;
      public class smallLinker extends Sprite
      {
        private var application:Application;
      }
    }
  2. Compile the swc
    compc -debug=false -o=my.swc smallLinker
  3. Compile your RSL:
    mxmlc -o=my.swf -file-specs=smallLinker.as
  4. Compile your application: mxmlc -external-library-path+=my.swc \
    -runtime-shared-libraries=http://www.yourhost.com/my.swf \
    -o=app.swf -file-specs=app.mxml
  5. Upload app.swf and my.swf to your host.
  6. Run your application and verify it works.

Popularity: 53%

Share and Enjoy:
  • Technorati
  • StumbleUpon
  • del.icio.us
  • NewsVine
  • Reddit
  • Digg
  • Furl
  • co.mments
  • blogmarks
  • Slashdot
  • DZone
  • Taggly
  • YahooMyWeb
  • connotea
  • Webride




Tags: , , , ,

This post was written by Virgil Cristea

Views: 1466

related

popular

1 Comment

have your say

Add your comment below, or trackback from your own site. Subscribe to these comments.

Be nice. Keep it clean. Stay on topic. No spam.

You can use these tags:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

:

:


« How to reduce the size of any flex app using RSL
» Cast to int issue