Migrating to Flex 4, StyleManager

I haven't seen this well documented before, but if you're component was using the style manager and is throwing a bunch of warnings in Flex 4, you need to get the "global" style manager now. You probably see this error:
"3608: 'getStyleDeclaration' has been deprecated since 4.0. Please use 'IStyleManager2.getStyleDeclaration on a style manager instance'."

This is really easy to fix, but not extremely well documented. StyleManager is no longer a global singleton, but there is an instance of it running already at the top of your app. Flex 4 has a new static class called FlexGlobals. You can use that to get a reference to the top of your app and then get the instantiated one.

//Flex 3 code
StyleManager.getStyleDeclaration("someStyle");
//Flex 4 code
FlexGlobals.topLevelApplication.styleManager.getStyleDeclaration("someStyle");

출처 : http://www.jonathanrowny.com/journal/migrating-flex-4-stylemanager

저작자 표시 비영리 변경 금지
신고
TAG
트랙백 ( 0 )개 , 댓글 ( 0 ) 개가 달렸습니다.

Commentary

댓글을 달아 주세요.

Add a Comment

comment에 대한 답변글은 해당 글상자에 있는 "R"(reply)버튼을 클릭하여 작성해 주시기 바랍니다.

티스토리 툴바