-
21 June 2010, 22:01
Flex 4: What happened to StyleManager?
On one my current jobs, I needed to update the Flex projects to use the new Flex 4. The update went pretty smoothly, except there were some warnings in Flash Builder saying things like
'getStyleDeclaration' has been deprecated since 4.0. Please use 'IStyleManager2.getStyleDeclaration on a style manager instance'Well, those annoyed me but I couldn't find anything on how to get rid of it. The only articles I could find were for the old way. Eventually I found something that did it.
Your Flex 3 code:
And the equivalent code you need to get rid of the warning:StyleManager.getStyleDeclaration("styleDec");FlexGlobals.topLevelApplication.styleManager.getStyleDeclaration("someStyle");StyleManageris being replaced by a global instance sitting at the top of your app.