views:

57

answers:

3

I am updating a Flex application which has the same functionality across a variety of categories (i.e. Baseball, Basketball, Football), but only needs access to the resources (~400kb images) of one category when it loads. I need to separate out the resources for each category so it only loads the ones its needs in order to save bandwidth and shorten load time for the end-user.

I've looked into ResourceBundle, but it seems best suited to locales.

How do you recommend setting up the architecture for such a project to reduce file-size for the end user who only needs to use it for one category when it loads? What tools within Flex/ActionScript can I use to do this?

+1  A: 

A common method for handling something like this is to have a set of XML files, one master and one for each category. The master XML will enumerate the categories and where to find the XML files for each of the categories. Then, each category XML file would describe all of the assets for that category.

Branden Hall
+1  A: 

You can embed some of your resources into a different stylesheet, compile them each to a separate SWF and then use the StyleManager to load each SWF dynamically at runtime. This page of the Flex docs shows how to deal with runtime style sheets:

http://livedocs.adobe.com/flex/3/html/styles_10.html#284678

You may also want to read the entire chapter as well for additional background info:

http://livedocs.adobe.com/flex/3/html/styles_01.html

cliff.meyers
This won't quite work for what I'm doing, but it helped get me on the right track -- thanks.
calvinf
Looking into it further, it looks like creating modules and using ModuleLoader is the best way to do what I needed for this app: http://livedocs.adobe.com/flex/3/html/help.html?content=modular_3.html
calvinf
A: 

Later, I realized Flex had modules and that I could use then to load components into my application at runtime. Read more about Flex 3 modules here.

calvinf