Reputation: 3368
I have created a pure Actionscript project that I need to embed and compile it inside Flex. The main reason is that I need to use Web Services and it's much more difficult to use them in Pro.
When the project is compiled in Pro, the resulted SWF is a mere 167KB - excluding web services and Flex's default preloader. When "hacked" into Flex, it is rocketed up to a whompy 975KB. The web services surely can't take 800KB in size. No graphics or sound is embedded in either.
This is the hackish way I use to embed my project inside Flex (main mxml) :
<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx" width="1300" height="700" applicationComplete="init()"
preloader="mx.preloaders.DownloadProgressBar">
<fx:Declarations>
<!-- Place non-visual elements (e.g., services, value objects) here -->
</fx:Declarations>
<fx:Script>
<![CDATA[
private function init():void
{
var show:TradeShowOrig = new TradeShowOrig();
this.stage.addChild(show);
show.init();
}
]]>
</fx:Script>
</s:Application>
I suppose that, what's bloated is the use of <s:Application>
which is also left unused. Can anyone recommend any way that might reduce the SWF's size?
Upvotes: 0
Views: 208
Reputation: 2614
There are two reasons you see a much bigger Flex application
As you point out, s:Application, which is a class that bases and references a good number of classes in Flex framework, has introduced 800K size to the application. I have used both Flash and Flex for years. Flex provides flexibility to create enterprise applications, it also provides CSS, spark skinning, flexible and fluid layout. These features enable enterprise developers to quickly create business applications. Though 800K looks big, we are no living in the age of 9600bps modem anymore.
Flex outputs debug and release SWF. The debug version of SWF is much bigger, so if you Export a Release Build, you would see a smaller size SWF.
Adobe also introduces cachable framework, which essentially externalize the flex framework as a cachable and reusable RSL that only needs to be downloaded once. This would shave quite a few KB's from the Flex application. To enable the feature, you would need to change how each libraries are linked in Flex Build Path dialog.
Upvotes: 3