Flex 4 skins and binding

I like the skin in Flex 4 - they offer a really good separation between logic and style.

I was wondering how people use snapping in their skins. The easiest way is to simply attach to the skin:

label="{ hostComponent.model.buttonLabel }"

you can also use 2 bindings:

selectedItem="@{ hostComponent.model.selectedItem }"

but you can argue that this is logic, so it really needs to be handled in the component. You do not want to recreate all the bindings every time you create a new skin. It seems fragile and prone to making mistakes.

So what are the alternatives? I suppose creating a load on the bucket of event listeners. I think adobe labels to observe and observeValues ​​can be useful.

How do others deal with this?

+3
1

, . . , , , , - , . , .

.

SKIN: label id="infoLabel"
COMPONENT: [SkinPart] var infoLabel:Label
creationComplete {
  BindingUtils.bindProperty(this, 'infoLabel', model, 'infoLabel');
}

. . BindingUtils . -, , , - {} , . - ( , ), , , .

EDIT: , AS3. MXML, , , , MXML.

+1

Source: https://habr.com/ru/post/1731754/


All Articles