I've a multi-module Flex 4 application. It's PureMVC modelled and during one of the startup commands it attempts to get a style. However, with Flex 4's new StyleManager per module approach, I can only get a reference to the topLevelApplication's styleManager which doesn't have the styles loaded that are loaded in the module.
I've scoured the web for a solution to this but to no avail. In a number of places the suggestion is to get the module and from it get it's factory which will allow me to
var info:IModuleInfo = ModuleManager.getModule("<filesystempath to module swf>");
var sm:IStyleManager2 = StyleManager.getStyleManager(info.factory);
which does indeed seem to give me back the correct style manager, however, it's got to be wrong because I can't be having to get the module and from it the StyleManager everytime I want to get a style for something in the code?
I would have hoped there'd at the very least be a ModuleManager method which I could supply the simple name of the swf as opposed to hav开发者_如何学Cing to cart around the absolute path?
So my question is, from within code in a module, how does one get a handle to the Module specific StyleManager?
Thanks for your time, Mark.
Well as far as I remember, in a Flex4 UIComponent you allways have a property styleManager that automatically references the current modules styleManager.
精彩评论