Today I was working on a Flex 3 application which I now want to compile using the Flex 4 SDK. One of the warnings that cropped up in the Flash Builder Problems panel was the following message:
3608: 'getStyleDeclaration' has been deprecated since 4.0. Please use 'IStyleManager2.getStyleDeclaration on a style manager instance'.
The line in question was the following which applies a global theme color after a color value has been loaded from a remote data source::
It took me some time to figure out what the heck the 'use IStyleManager2.getStyleDeclaration on a style manager instance' actually meant... it was by no means a straight forward warning. After some Googling and trial and error I came up with this which seems to do the job:
2cssDeclaration.setStyle('themeColor', '0x'+gradient_to);
I'm not sure if this is the correct and/or best way to achieve the same thing but it appears to work which generally is good enough for my requirements :-)
Hope this helps someone, please leave feedback and corrections where applicable.

#1 by Cesare on 7/16/10 - 11:08 AM
#2 by Simon Bailey on 7/16/10 - 11:47 AM
styleManager.getStyleDeclaration('.declaration').getStyle('style')
IStyleManager2 is a Singleton that gets instantiated on first request (I think when the application first loads and CSSStyleDeclarations is called on initialise) and calling getStyleDeclaration pulls the styles from that Singleton so the FlexGlobals reference shouldn't (I think but could be corrected) be needed.
Cheers geeza,
Simon
#3 by rob on 7/16/10 - 9:16 PM