Flex 4更改皮肤部分值
你好 我想在运行时更改皮肤特定部分的可见性,但我不知道如何实现它。
Hello
I would like to change the visibility of specific part of the skin at run time, but i dont know how to reach it.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
你所说的“达到”是什么意思?
组件类和外观类都通过使用该组件的名称来引用外观部件。我通常在运行时隐藏皮肤部分的方法是使用以下过程:
1)创建一个新的皮肤状态;类似于“skinPartHidden”
2) 在 Component 类中;创建 SkinPartVisible 属性。当属性值改变时;调用 invalidateSkinState() 方法。这将导致 getCurrentSkinState() 在下一个渲染事件期间运行。
3)在get getCurrentSkinState()方法中;使用该属性的值将皮肤状态设置为新的 SkinPartHidden 皮肤状态。像他的一样:
4)在皮肤课上;使用 MXML 状态语法根据外观状态切换外观部件的可见性。像这样的东西:
visible.skinPartHidden="true"
What do you mean by "reach it"?
Both the component class and the skin class have a reference to the skin part by using that component's name. How I would usually hide a skin part at run time is using this process:
1) Create a new Skin State; something like "skinPartHidden"
2) In the Component class; create a skinPartVisible property. When the property value is changed; call the invalidateSkinState() method. This will cause getCurrentSkinState() to run during the next render event.
3) In the get getCurrentSkinState() method; use that property's value to set the skin state to your new skinPartHidden skin state. Something like his:
4) In the skin class; toggle the visibility of the skin Part based on the skin state using the MXML state Syntax. Something like this:
visible.skinPartHidden="true"
这取决于您想隐藏/显示哪一部分。如果您正在谈论一些特定于皮肤的图形(不表示为主机组件中的
[SkinPart]
声明),那么您可以实现两种策略:hostComponent
属性的数据绑定。要更改已知声明的皮肤部分的可见性,您可以使用上面列出的策略的修改。在第二种策略中,您不需要声明皮肤部分:)
It depends on what part do you want to hide/reveal. If you're talking about some skin specific graphics (which is not represented as
[SkinPart]
declaration in a host component) then you can implement two strategies:hostComponent
.For changing visibility of known declared skin part you can use the modifications of strategies listed above. In the second strategy you needn't to declare skin part :)