0
votes

I had a simple flash video player I was compiling using Adobe Flash Builder , but now I am compiling it using Flex SDK 4.6 . Flash filesize was 20KB when I was compiling with FB . Now it's 280KB . I know that it adds some swc files to swf build , I have disabled debug etc instructions provided here http://livedocs.adobe.com/flex/3/html/help.html?content=performance_06.html . Is it possible to somehow convert fla components without using mxml ?

Here is my mxml code

<?xml version="1.0" encoding="utf-8"?>
<mx:Application backgroundColor="#000000" xmlns:fx="http://ns.adobe.com/mxml/2009" 
                xmlns:mx="library://ns.adobe.com/flex/mx" layout="absolute" minWidth="320" minHeight="240" creationComplete="initApp()">
    <fx:Script>
        public function initApp():void{
            var p = new video_player(uic);                      
        }       
    </fx:Script>    
    <mx:UIComponent id="uic" />      
</mx:Application>

video_player.as

....Import statements
public class video_player{      
        private var uic:UIComponent
        var fullScreen:Image;
        var rtmpApplication:String;
        var streamName:String;
        public function video_player(_uic:UIComponent) {
            uic=_uic;
            if (FlexGlobals.topLevelApplication.parameters.hasOwnProperty("applicationName")) {
                rtmpApplication=FlexGlobals.topLevelApplication.parameters.applicationName;
            }
            if (FlexGlobals.topLevelApplication.parameters.hasOwnProperty("streamName")) {
                streamName=FlexGlobals.topLevelApplication.parameters.streamName;
            }       
            vPlayer=new Video(playerwidth,playerheight);
            uic.addChild(vPlayer);
            init();         
        }

        public function init(){
         //add fullscreen image in flash top right , and event handler
         //Code to connect to live application and play video using NetConnection and NetStream
        }

}

Is there any way around this?

1
Can you share information on how your compiling them? Do you have an ActionScript only project in Flash Builder? Is the framework set to be an RSL? As far as I know, it is not possible to create fla components with MXML.JeffryHouser
@Reboog711 Thanks Jeff for your comment I posted mxml , actionscript code . I tried "-link-report" while building and it shows .swc files embeded in which causes file to be large. I will really appreciate any help .Multicaster
As soon as you use the <mx:Application> tag, you're adding bloat to your SWF. You made it sound like originally, your code did not depend on the Flex framework, so what did that code look like? If your original code was the same, perhaps you originally were compiling with RSL's (as stated above), and now you're not? However, even with RSL's I've never seen a Flex SWF get as small as 20Kb.Sunil D.
@SunilD. I was building with Flash Builder , It was an FLA file and it was using swf components . No mxml file or no Flex . Only reason using Flex SDK was to avoid Flash Builder License and cost .Multicaster
Ok that explains it: Flash Builder is an IDE we use with Flex and pure Actionscript projects. If you've created a FLA file, then you were not using Flash Builder. You were using Flash Professional (or the Flash authoring tool, Flash CS5, Flash CS6... I never know what to call it). Unfortunately, as soon as you switch to Flex you're adding a LOT more code to your project. Compiling w/the Flex RSL's is one way to combat the bloat. The default setting is to use RSL's, so it's likely your Flex based SWF won't get any smaller.Sunil D.

1 Answers

2
votes

Also I have added option -static-link-runtime-shared-libraries=true so it wont download anything runtime . Without that flash size is 49KB

By setting the above option, you have told the compiler to include all of the Flex framework classes (that are used by your application) in the application SWF. So your SWF grows from 49KB to 280KB.

This is the "RSL" thing (runtime shared library) that @Reboog711 and I were talking about. If you use the Flex RSL's, then all of that Flex framework code is not included in your application SWF. The Flex framework RSL's are signed by Adobe and can be cached by the Flash Player. So using them is always preferable. (Note: I'm assuming this all still works with Apache Flex)

Finally, I wish to reiterate that in Flash Builder there are two basic kind of projects you can create: Flex project, Actionscript project. I'm ignoring the mobile options, but the same applies to them:

An Actionscript project will, in general, result in a smaller SWF because you are not relying on any of the Flex framework classes. It sounds like you could make your video player app even smaller (closer to the 20KB size you originally had) if you were to create an Actionscript project.