While programming in Flex 4.5, I came across an issue that took forever to figure out. It had to do with the ModuleLoader class and the inability of it to inherit styles from the application that was loading it.
According to Flex documentation, a Module that is loaded into the same application domain as it’s parent container should inherit the styles of the application. In that way, you should be able to create an application, set some style sheets for it, then load modules that inherit them.
I know there’s something to be said about StyleManagers in Flex 4.5; according to some documentation I’ve read, it appears that all applications and modules have their own implementation of the StyleManager whereas in previous versions of Flex, the StyleManager was a Singleton and globally applied to all applications and modules; but I don’t really understand the implementation of it as much as I would like.
That being said, I’m left to implementation, testing and debugging.
ModuleLoader
In my application, I referenced my style sheet using the fx:Style tag near the top of my MXML document:
<?xml version="1.0" encoding="utf-8"?> <s:Application xmlns:mx="library://ns.adobe.com/flex/mx" xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" width="1040" height="100%" creationComplete="onCreation()" initialize="onInit()" name="My Application"> <fx:Style source="resource/style.css" /> ...
Next, I imported my ModuleLoader class and declared a private instance of it:
<fx:Script> <


