If you’ve switch over to Flex 4 or in the process of switching you’ll notice Modules are missing from spark.
We didn’t want to be stuck with the old ModuleLoader and Module based on VBox and LayoutContainer, so here’s our new versions based on Group.
They should work pretty much the same as the mx versions with one change, there is now an additional
You can use this property to specify when the ModuleLoader should load its content. This was added to solve a problem I’d ran into a few times with the mx version. I’d have multiple ModuleLoaders in a ViewStack but they would all load immediately and at the same time. It didn’t make sense to load a Module unless the user actually wanted to view it.
ModuleLoadPolicy.ADDED – load when the ModuleLoader is added to a displayList
ModuleLoadPolicy.ADDED_TO_STAGE- load when the ModuleLoader is added to the stage
ModuleLoadPolicy.IMMEDIATE- load immediately (the same as the mx ModuleLoader)
ModuleLoadPolicy.NONE- do not automatically load.
ModuleLoader.loadPolicy has 4 valid values
ModuleLoader.loadModule() must be manually invoked to load the module