This content has been marked as final. Show 4 replies
I believe that you can change the RSL URL as well and have the application build the swf and put it in the location that you specify. Under project settings, Flex Build Path, Library path, you open a particular library, select the RSL URL and click on the Edit... button. (You'll still have to do this for each application's project, but it beats copying the file over on each build.)
Does that work for you?
When I check the auto extract swf it places the swf in the projects root folder of that project, this would be fine if I only had one project, but I have other projects that are essentialy child apps and they would then each have a copy in their source folder which means that library gets loaded again in the child app as it is in a different location.
Here is another observation about flex and merged code....Any thoughts are greatly appreciated.
The main flex library is just over 1 meg, if you add in charting it’s close to 2 megs.
When you create a project and start adding applications to it even small ones are around 200 – 400 K each and they seem to each contain copies of the dependencies, so it appears that each app in the project contains merged code, the needed parts of the flex framework.
So in a medium size app why not load / cache the framework libraries once and have apps that range from 10 – 20 K.
In a project you would normally have a main app that is a loader for the child apps, so the child apps don’t need to contain the dependencies already loaded when the main app loads, however based on the file size it appears that each app contains it’s own copy of the parts of the framework it needs.
So even better would be a way to have flex know that a main app will always be loaded first so it does not embed identical resources into each child app.
Ah, so it's ignoring the RSL URL when it comes time to do the auto-extract? That's unfortunate.
My next guess is that you might be able to make this work by playing with the additional command line options in the library project. I think you want -directory=true. I've tried this out locally, and my library project called "Shapes" created "bin/Shapes.swc" as a directory instead of a zip file. In other words, I can now reference the SWF directly with "bin/Shapes.swc/library.swf". The path is a bit weird (it would be more straightforward if the SWF were directly inside the bin folder), but I think it will get around your problem.
Unfortunately, while this makes the compiler happy, our code model (which is behind code hints, go to definition, and such) no longer has a SWC to read to learn about all of the classes defined in your library. So none of those features know about the library classes. Arg.
Maybe if you make two library projects for each library source folder... one with directory=true that extracts the SWF and one without that builds the SWC. (Use a linked folder to share source between them.) Include the latter in the build path for your project, but set its RSL URL to point to the SWF in the former. Then both the compiler and the code model should be happy. Not that this is getting at all complicated...
You could always give in and put the main application and the sub applications into the same project and just use the version of the SWF that's generated in that project's output folder. Or maybe the right solution here is to allow the multiple copies of the SWFs during development, then (after you get things working) build things the way you like them using the command-line compiler in a batch.
In the meantime, I'll make sure to file some sort of enhancement request to untangle this mess.
P.S. As to the more general comments about limiting loads of shared content between multiple applications... I recommend posting a new topic on the Flex 2 General Discussion forum to see if you can drum up some discussion. That way, it won't get lost here on the forum for tool-specific stuff.
Thanks for providing such a detailed response. I just started examining a strategy for creating a very large modular dashboard app with literally hundreds of child apps, this is being converted from a browser based AJAX app and we are so happy to be using FLEX! And have a true type safe environment.
That said lets consider the following structure each APP is an swf….
[CHILD APP A]
[CHILD APP A_1]
[CHILD APP A_2]
[CHILD APP B]
[CHILD APP B_1]
[CHILD APP B_2]
Main app is always loaded, so Child A would never contain any duplicate framework or library code.
Child A is always loaded before Child A_1, so Child A_1 would never contain any duplicate framework or library code already in Main or Child A.
I think if this were possible Main would be the same size as it is now, but Child A and Child A_1 would be much smaller.
So in Flex Builder we have one app in the root, and create a dependency chain using the same folder structure used to create package namespace chains…
Child A could also be broken into another project, and [Default] could signify the parent.
I have posted my earlier findings on file size in the general forum, and will continue to search for the best solution to duplicate merged code and decreasing the file size.