I have a fairly large Flex/Flash Builder project using Flash Builder 4.5. I want to create another project that uses some of the components from that original project. In the new project, I link resources with the original project and it works fine but the new project's file size is pretty large. It's close to the original project's file size even though it only uses a fraction of the components and assets. Is there a better way to do this to minimize the file size of the new project?
You should separate all the common, reusable code into one or more library projects. In FlashBuilder you cannot convert the nature of a project from application to library, so you'll have to create a blank library project and copy over the code that you want available in both projects.
In its simplest form you project structure should look like this:
Flex app project A (swf) \
Flex library project (swc)
Flex app project B (swf) /
Now to use that library, go to 'Properties > Flex Build Path', click the 'Add Project...' button and select the library project you just created.
Now that you've linked to that project, you want to choose how the referenced components will be linked. (Double click on 'link type' to edit.)
With your way of linking your projects FB apparently just compiled all classes from project A into project B. That's obviously not what you want. These are your linkage options (for an application project):
Which option to choose depends on the situation and is entirely up to you. I suggest you play around to see the difference for yourself (use a real server, because on a local server you won't get a feel for the loading times).
I should also mention there is the external linkage option, which doesn't compile any classes into the main app and also doesn't load them at runtime. This is primarily used for dependencies between libraries that will be used as RSL's in the same main application.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With