Flex4中的StyleManager怎么用?
在Flex3.0中改变样式方法:
var newStyleDeclaration:CSSStyleDeclaration = new CSSStyleDeclaration(".bigMargins"); newStyleDeclaration.defaultFactory = function():void { leftMargin = 50; rightMargin = 50; } FlexGlobals.topLevelApplication.styleManager.setStyleDeclaration(".bigMargins", newStyleDeclaration, true);
还有,使用类型选择器时要记得把namespace写完整,如spark.components.Button或者mx.controls.Button,否则编译器不知道你到底要调用哪个Button,容易报出空指针。