Skip to main content
Participant
August 5, 2011
Question

Recommended way of Skin binding - Use hostcomponent or getter/setter

  • August 5, 2011
  • 1 reply
  • 1022 views

Were building an app with a lot of custom components used for displaying objects.

I'm wondering what is the recommended way of binding properties in the skin to properties in the hostcomponent class.

For example is have a class with a property Person.

And in my skin i have a couple of textInput's displaying the person data.

Now i often use {hostComponent.person.name} in my skin to bind the properties.

I know i can use getters/setters and commit properties as well to get the same result.

But this creates a lot of code for doing the same thing.

Is there a recommended way of binding properties in the skin to the hostcomponent class?

This topic has been closed for replies.

1 reply

Adobe Employee
August 5, 2011

The code generated to support {} binding is probably way more than you'll

write in your commitProperties.

Note that we currently recommend using the partAdded API in the host.

Participant
August 8, 2011

I'm using the partAdded as well in my code, but mainly to add eventHandlers to components in my skin.

If i would set the content like so:

if(instance == txtMyText){

     txtMyText.text = this.person.name;

}

the text input is not binded to the person property.

I could use the bindingUtils to solve this but i realy dont like this because it uses strings for the properties.

We also use a lot of 2way binding so when the user changes the input the object is changed as well.

How would i do this in my class without using the bindingutils?

Adobe Employee
August 8, 2011

So things the skin displays are changing at runtime? At minimum, you can

add event listeners to that one thing and wire change events back. That's

what is going on under the covers for two-way binding, but there is a lot

more general glue that you may not need.