How to send to the skin some value which have changed?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
There are two approaches to this: one uses binding and is easier, the other is more complex but better for performance.
Using binding
Suppose your view class looks like this:
then you can bind to that value in your skin like this:
Overriding commitProperties
Assume the same skin without the binding, then you can set the label’s text property by using a skinpart and overriding commitProperties in the host component. The skinpart’s name must be exactly the same as the id of the component in the skin (in this case ‘myLabel’).
Of course you would have to call
invalidateProperties()whenever you want to apply the new value (for instance in a setter function for ‘myLabel’). Also notice that ‘myLabel’ no longer needs to be bindable, unless you would want to be able to bind on it externally.edit: which approach to choose?
I have just answered a question that is closely related to this one in which I elaborate on the pro’s and cons of each approach in different situations. You can find it here: Flex: Additional label in ButtonBarButton