开发者

Possible to pass parameters to a skin?

开发者 https://www.devze.com 2022-12-25 20:31 出处:网络
I have 2 skins, almost identical, but differ in 1 small way that can be accounted for if I could pass a Boolean to the skin while assigning it to the host component (a button).

I have 2 skins, almost identical, but differ in 1 small way that can be accounted for if I could pass a Boolean to the skin while assigning it to the host component (a button).

<s:Button skinClass="MyBtnSkin" />

Is there a way while assigning the skin to the button, I could also pass a param开发者_开发百科eter to the skin somehow?


You have to create a Button subclass and add your custom boolean property in it.

<s:MyCustomButton skinClass"MyBtnSkin" customProperty="true" />

Updating your skin file when customProperty changes could be done with binding afterwards.

<Rect ... visible={hostComponent.customProperty}>
0

精彩评论

暂无评论...
验证码 换一张
取 消