I've encountered the same problem.
The solution is here:
These two are essentially the same.
Don't forget to first
Thanks for the help! though I've already find it out that using '
FlexGlobals.topLevelApplication'help overcome this problem, though I missed to mention it at here... Thanks!
Using FlexGlobals.topLevelApplication.styleManager will work fine if you do not use the code in a sub-application or module because it will always use the style manager of the topLevelApplication. An equalivent way of getting the top-level style manager is "StyleManager.getStyleManager(null);".
The call to StyleManager.getStyleManager accepts a moduleFactory as a parameter. To get the style manager of a sub-application or module pass in the moduleFactory of the sub-application or module.