Reputation: 2604
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.
Upvotes: 0
Views: 939
Reputation: 39408
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:
if(skinPartVisible == false){
return "skinPartHidden";
}
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"
Upvotes: 2
Reputation: 14221
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 :)
Upvotes: 2