if you import a component. that only includes in size. not whole library.
I'm not sure i understand what you mean.
you are going to specify Flex SDK path. if you use some component from the sdk SWFs are comiled only with them.
where SWC comes here?
do you have your own library?
No, thats not how it works. The entire SDK in your project is compiled into the output SWF file whether you use all the libraries (swc files) or not. So even if you have an application with 1 spark textInput, it will package the entire spark.swc, the mobilecomponents.swc as well as all the other swc files that make up the Flex 4.6 SDK. I have just created such an application and decompiled my SWF to verify this - see attched screenshot of the decompiled SWF. That's from a mobile spark app with a single spark field - thats all it contains.
Oh, by the way - that SWF with a single field is 3mb so you can see why i dont want to include the entire SDK for just a couple spark components.
optimizeByteCode is true by default if not set, but i have now explicitly set it anyway. I exported a release build which is 1.21 mb so it is smaller but still not as small as your SWF. Viewing the SWF in the decompiler shows it is still including all the same files as earlier, unlike yours. Was your sample application a Flex Mobile Application and is there anything else you are doing to remove those unused components?
this is my code and i compiled SWF in release mode. ensure you are compiling in release mode.
<?xml version="1.0" encoding="utf-8"?>
<!-- Place non-visual elements (e.g., services, value objects) here -->
Yes, my code is almost identical. By compiling in release mode do you mean exporting a release build of the application?
Yes, thats what I was referring to. I have been exporting a release build. Maybe the difference is that I am using Flash Builder which is packaging unused components and whatever you are using is not including the unused components. Are you using command line?
i think flashbuilder should work good. you might missed or added some settings.
sorry .i don't know much about flashbuilder. someother need to help you.
Getting the entire Spark library linked into your SWF is definitely not normal behavior for Flash Builder. The two linkage options are
1) Runtime Shared Library. In this case, none of the library are linked into your SWF. Instead, the entire library gets loaded at runtime.
2) Merged Into Code.In this case, only the classes you need from the library get linked into your SWF.
Gordon Smith, Adobe
Im using option 2: Merged into code. I have just recreated this on a colleague's laptop as well with the same result.
Could you perhaps see if you can follow these steps and see what happens on your side.
- Create a new Flex Mobile Project > SDK 4.6.0 > Google Android Platform > Blank Application Template > Finish
- Add <s:TextInput/> under declarations tag
- Export Release Build > Intermediate AIRI package that must be manually signed later > Finish
- Decompile the SWF from the .airi package (I'm using Sothink SWF Decompiler)
- Expand Action > Spark > Components
My components folder contains many spark components im not interested in packaging - see screenshot attached above for the full list. All we added was a spark textInput and the swf contains Buttons, Scrollbars, TabbedViewNavigator etc. Thus the reason for this post.