flex-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Harbs <harbs.li...@gmail.com>
Subject [FlexJS]Data binding problems
Date Sun, 27 Nov 2016 15:07:29 GMT
Another area where “old” Flex was easier is data binding.

Currently, to get data binding to work, you need to specify the correct data binding bead.
That’s great, but I’m not sure it covers all cases, and knowing what to use where is not
immediately obvious.

Additionally, a lot of uses of “data binding” is not really data binding at all. Being
able to specify a property in curly brackets is a very convenient method of specifying values
which need to be evaluated at instantiation, even if they never need to be evaluated and “bound”
at runtime.

I think this kind of simple evaluation should work even if data binding beads are not used.

Even if I specify data binding, the kind of data binding I’m used to doing does not work
very well in FlexJS. I have a PanelStrings class which has a bunch of getters for localized
strings. The strings are evaluated at runtime based on the locale. I have a lot of text=“{PanelStrings.FOO}”
in my code which generate compile errors. The only way I was able to see to get rid of the
errors was:
1. Declare a local (public) Bindable variable: [Bindable]public var FOO:String = PanelStrings.FOO
and declare that. It’s a pain to double declare these strings everywhere they are used in
2. Used a static function: text=“{PanelStrings.getStr(‘FOO')}”. This is error prone
because “FOO” can easily be misspelled.

Is there a way to bind class static getters in FlexJS? In “classic” Flex, just making
the class extend EventDispatcher, made the compiler stop complaining.

View raw message