As you may know, in Flex 4 you no longer call the StyleManager class as a singleton (StyleManager.getStyleManager()). Instead, StyleManager implements IStyleManager2 and you can get a reference to the styleManager directly, like this:
var styleManager:IStyleManager2 = FlexGlobals.topLevelApplication.styleManager;
A new gotcha I ran across today, while converting a Flex 3 project to Flex 4, was the way style declarations are referenced. Take my current issue as an example:
I worked for a while to understand why the stylesheet variable was null, every time. Then I decided to actually inspect the selectors attribute of the stylemanager and realized that the reference to the selectors has now changed! The reference must now include the full package of the class. This makes a lot more sense, considering that Spark added a whole set of new classes with the same name. Now I changed my code to the following:
Perfect! Now my style delcaration was being set as I expected. I hope this tip helps you.
Tags: Flex, Flash & AS3