To remove a CSSStyleDeclaration object, use StyleManager.clearStyleDeclaration()
<?xml version="1.0"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
creationComplete="initApp()">
<mx:Script>
import mx.styles.StyleManager;
private var myDynStyle:CSSStyleDeclaration;
private function initApp():void {
myDynStyle = new CSSStyleDeclaration('myDynStyle');
myDynStyle.setStyle('fontSize', 24);
StyleManager.setStyleDeclaration(".myButtonStyle",myDynStyle, true);
}
private function resetStyles():void {
StyleManager.clearStyleDeclaration(".myButtonStyle",true);
}
</mx:Script>
<mx:Button id="myButton" label="Click Me" styleName="myButtonStyle" click="resetStyles()" />
</mx:Application>
Related examples in the same category