If you are developing an Enterprise application in Flex, you must be asking yourself “how do i reduce the size of my SWF file?”. This is important because, bigger the file, the more time it will take to load. There are a few ways to do, but one of the ways that is not so common is out there is “not to embed images” in the SWF file.
Most of the examples that I have seen and gone through I have seen people do the following; which leads to Flex compiler picking up the image and puts that in the SWF file. This leads to increasing the file size.
<mx:Image source=”@Embed(source=’assets/welcome.jpg” height=”228″ scaleContent=”false” top=”10″ width=”429″ horizontalCenter=”0″‘)/>
Instead, if you would do the following, the image will requested from the web server when the Flex needs it. And, also as the images can be cached by the browser, after first time load, your client would not even need to request them again. How many times do you change assets in your application, so on every new deployment of the SWF file you do not need to worry about the static assets.
<mx:Image source=”assets/welcome.jpg” height=”228″ scaleContent=”false” top=”10″ width=”429″ horizontalCenter=”0″/>