1

I have a complicated application. I use Flex 4.1 RSLs and custom RSLs for all my libraries (and there are like 15 of custom SWCs - Flex Library Project)

I would like to load main application with minimal RSLs needed and then load Flex Module with all other RSLs in the background while users interacts with first part of app.

Main app needs 3 SWCs, Module needs rest of them (12).

If I have one Flash Builder Apllication project with Application.mxml where I have all RSLs linked (as RSLs) and Module.mxml

How do I solve this, so RSLs are loaded with the Module into child application domain?

Currently I am using:

info = ModuleManager.getModule(URL);
info.load(new ApplicationDomain(ApplicationDomain.currentDomain));

... so it should load into new App domain, but RSLs are preloaded into parent domain already!.

I am using static fields/singleton in my Module so I can't load more of them.

If I could load Module with its RSLs into child app domain, Class definitions would separate and I could use two Modules, each with its own static fields.

mizi_sk
  • 1,007
  • 7
  • 33

2 Answers2

1

Why not try the OSGI-inspired Potomac modularity framework? It allows you to have much more exact control over the loading of assets. It may involve some refactoring, but the fact that you have 15 different compiled assets in your application suggests that you are already thinking along modular lines.

EDIT:

I should point out that Potomac will load all of the "bundles" into the application domain, but it does solve your issue of loading your assets on demand. I'm not sure which part of your problem is the most important issue. You might also look into sub-applications, which may or may not fit your requirements.

Ryan Lynch
  • 7,676
  • 1
  • 24
  • 33
  • Thanks, it looks useful. However now it seems, that we need to get rid of Flex heavy loading, so I won't use it in this project. With Flex 4.5 came Remove unused RSL and loading them with modules into theirs child domains see [Using RSLs with modules and sub-applications](http://help.adobe.com/en_US/flex/using/WS2db454920e96a9e51e63e3d11c0bf674ba-7fff.html#WS19f279b149e7481c-152c7c012d9aabe32a-7fff) and [Customize project builds](http://help.adobe.com/en_US/flashbuilder/using/WSe4e4b720da9dedb524b8220812e5611f28f-7fe1.html) – mizi_sk May 10 '11 at 14:46
1

Solution came with Flex 4.5 -- Introduction to RSLs

Using placeholder RSLs

When you compile an application with Flex, the default behavior is to compile the application against the framework (or default) RSLs. When the application runs, it loads only the framework RSLs that it actually uses, and creates placeholders for the remaining framework RSLs. When the application loads a module or sub-application that requires one of the framework RSLs for which there is a placeholder, the module or sub-application then loads that RSL into the main application.

see Adobe Flex 4.5 - Introduction to RSLs @ help.adobe.com

mizi_sk
  • 1,007
  • 7
  • 33