Apache flex styleManager:使用setStyleDeclaration时出现问题
嘿,伙计们Apache flex styleManager:使用setStyleDeclaration时出现问题,apache-flex,actionscript-3,flex4,coding-style,Apache Flex,Actionscript 3,Flex4,Coding Style,嘿,伙计们 我正在使用styleManager.setStyleDeclaration为同一组件的多个实例设置CssStyleDeclaration对象,这些实例正在不同的画布中使用。 我想在各种画布中设置此组件的不同属性,但我想,当setStyleDeclaration使用组件名称并全局设置其样式时,这种情况不会发生。 以下是第一个cssstyledeclaration: this.dataTickerOddStyle = new CSSStyleDeclaration();
我正在使用styleManager.setStyleDeclaration为同一组件的多个实例设置CssStyleDeclaration对象,这些实例正在不同的画布中使用。
我想在各种画布中设置此组件的不同属性,但我想,当setStyleDeclaration使用组件名称并全局设置其样式时,这种情况不会发生。
以下是第一个cssstyledeclaration:
this.dataTickerOddStyle = new CSSStyleDeclaration();
this.dataTickerOddStyle.setStyle("fillColors", StringUtilEx.ExtractColorPair(o.DataTicker.Item[0].Background_Fill_Colors));
this.dataTickerOddStyle.setStyle("fillAlphas", StringUtilEx.ExtractNumberPair(o.DataTicker.Item[0].Background_Fill_Alphas));
this.dataTickerOddStyle.setStyle("gradientRatio", StringUtilEx.ExtractNumberPair(o.DataTicker.Item[0].Background_Gradient_Ratios));
this.dataTickerOddStyle.setStyle("cornerRadius", int(o.DataTicker.Item[0].Background_Corner_Radius));
this.dataTickerOddStyle.setStyle("borderColor", StringUtilEx.ConvertToColor(o.DataTicker.Item[0].Background_Border_Color));
this.dataTickerOddStyle.setStyle("borderThickness", Number(o.DataTicker.Item[0].Background_Border_Thickness));<br>
另一个cssstyledeclaration是:
this.m_zoneBackgroundStyle = new CSSStyleDeclaration();
this.m_zoneBackgroundStyle.setStyle("fillAlphas", StringUtilEx.ExtractNumberPair(o["Background_Fill_Alphas"]));
this.m_zoneBackgroundStyle.setStyle("fillColors", StringUtilEx.ExtractColorPair(o["Background_Fill_Colors"]));
this.m_zoneBackgroundStyle.setStyle("gradientRatio", StringUtilEx.ExtractNumberPair(o["Background_Gradient_Ratios"]));
this.m_zoneBackgroundStyle.setStyle("borderColor", StringUtilEx.ConvertToColor(o["Background_Border_Color"]));
this.m_zoneBackgroundStyle.setStyle("borderThickness", Number(o["Background_Border_Thickness"]));
this.m_zoneBackgroundStyle.setStyle("cornerRadius", Number(o["Background_Corner_Radius"]));
为此,我使用以下方法:
this.fill.styleManager.setStyleDeclaration("com.GradientCanvas", AppStylesheet.instance.m_zoneBackgroundStyle, true);<br>
this.fill.styleManager.setStyleDeclaration(“com.GradientCanvas”,AppStylesheet.instance.m_zoneBackgroundStyle,true)
请注意,我使用的是同一个选择器/组件。请在这方面帮助我。请提前使用thanx(我不确定我是否完全理解您的意思。但是)
可以在单个零部件实例上设置样式,而无需更改全局样式
component.setStyle( ... )
而不是
CSSStyleDeclaration.setStyle( ... )
我解决了这个问题。我以前使用的是
类型选择器
,而不是类选择器
谢谢你的回答。我解决了问题..以前使用类型选择器而不是类选择器。
CSSStyleDeclaration.setStyle( ... )