StyleManager从Flex3迁移至Flex4
发布时间:2020-12-15 05:07:06 所属栏目:百科 来源:网络整理
导读: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: 'getStyleDeclar
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");
(编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |