我可以在 Flex Builder 中更改标签的颜色,我什至可以将颜色绑定到变量并且可以工作,但我找不到颜色属性以便以编程方式更改或引用它!用于更改 Flex RIA 中一段文本的字体或颜色的 ActionScript 3.0 代码是什么 - 或者是否关心您的文本以什么颜色显示太奇怪而不是 RIA 请求?我在“学习”flex后几分钟就写了整个应用程序,为什么我花了三天时间,我仍然无法改变我愚蠢的标签的颜色?!
I can change the color of the label in Flex Builder, I can even BIND the color to a variable and that works, but I can't find the Color PROPERTY in order to change or reference it programatically! What is the ActionScript 3.0 code to change the font or color of a piece of text in a Flex RIA - or is caring in what color your text appears too bizzarre a request for a RIA? I wrote whole applications after just minutes of "learning" flex, how come it's taken me three days and I still can't change the color of my stupid label?!
发布评论
评论(1)
您遇到了属性和样式之间的区别(有时称为样式属性来迷惑您)。对于 UIComponent,
color
通常是一种样式。在mxml中,两者都被初始化为XML属性;在 Actionscript 中,属性是简单的成员变量,而样式则由 StyleManager。
简而言之,您可以通过调用 <代码>UIComponent.setStyle:
You're running into the difference between properties and styles (sometimes called style properties to confuse you). For a UIComponent,
color
is typically a style.In mxml, both are initialized as XML attributes; in Actionscript, properties are straightforward member variables, while styles are dealt with by the StyleManager.
In short, you set styles by calling
UIComponent.setStyle
: