2011-08-24 68 views
1

我抄代碼(其它成分=>集裝箱=> TitledBorderBox)的Flex 4-警告:-3608:從Adobe環法自行車Flex的

var style:CSSStyleDeclaration = StyleManager.getStyleDeclaration("TitledBorderBox"); 

,但我發現在TitledBorderBox.as警告:

warning: -3608: 'getStyleDeclaration' has been deprecated since 4.0. Please use 'IStyleManager2.getStyleDeclaration on a style manager instance'.

如何清除此警告?請幫幫我。

+1

在樣式管理器實例上使用'IStyleManager2.getStyleDeclaration? –

+0

:)我也以爲相同,但力量的工作... –

回答

2

用這個代替:

FlexGlobals.topLevelApplication.styleManager.getStyleDeclaration('TitledBorderBox') 
+0

謝謝你這個作品對我... –

1

使用以下:

var style:CSSStyleDeclaration = styleManager.getStyleDeclaration("TitledBorderBox"); 

由於Flex 4每UIComponent實例has corresponding field

或者您可以切換項目以使用Flex 3 SDK。

+0

謝謝你的回答,但我必須使用FlexGlobals.topLevelApplication.styleManager否則我會得到錯誤未定義的屬性:styleManager –

+0

我建議您不要使用misc靜態字段和全局變量。只需切換項目即可使用Flex SDK> = 4.1。 – Constantiner