如何通过styleManager访问内部控件?
我想知道是否有办法通过 styleManager 访问 Spark 控件(比如说面板)的内部控件?
我使用以下代码来访问 Panel 的 CSS 属性:
styleManager.getStyleDeclaration("spark.components.Panel")
.setStyle("backgroundColor", "blue");
我无法弄清楚如何访问内部控件(如 displayLabel)。我知道使用 CSS 样式可以做到这一点,但我想在运行时更改它们的属性。
这怎么能做到呢?
I'd like to know if there is a way to access inner controls of the spark control (lets say Panel) through the styleManager?
I've used the following code to access Panel's CSS properties:
styleManager.getStyleDeclaration("spark.components.Panel")
.setStyle("backgroundColor", "blue");
I'm unable to figure out how to access the inner controls like displayLabel. I know that this is possible using the CSS styling, but I'd like to change their properties at runtime.
How can this be done?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我不确定这是否仍然是最新的,但我认为您需要做的是在 CSS 中以某种方式声明内部类(如果您不关心,可能是空的)。一旦它们存在,styleManager 就可以访问它们的值。您还可以执行以下操作:
在您的 MXML 声明中,然后该样式就存在。
这里有一些相关的例子:
http://help.adobe.com/en_US/flex/using/WS2db454920e96a9e51e63e3d11c0bf687e7-7ff6.html
[这与我自己在 StyleManager 中遇到的问题有关,谷歌引导我到这里,这就是迟到答案的原因]
I am not sure if this is still current, but I think what you need to do is to declare the inner classes somehow in your CSS (possibly empty if you don't care). As soon as they exist there, the styleManager can access their values. You can also do something like this:
In your MXML declaration, and then that style exists.
There are a few related examples here:
http://help.adobe.com/en_US/flex/using/WS2db454920e96a9e51e63e3d11c0bf687e7-7ff6.html
[This is related to an issue I have myself with the StyleManager and google led me here, that's the reason for the late answer]