Well, bindingFixer will only work one
level down because the return type is object and therefore a property that
hangs off of it is of unknown type, so I would still expect a warning for “buz”
in this case. Rather than creating a separate function you can also just cast
to Object:
{Object(Object(foo.bar).baz).buz}
We recently ran into the "Warning: Changes to unknown property ...
will not be detected" compiler issue.
All the usual tricks did not
work and the FAQ did not help.
This problem is often the result of the binding
being
more agressive than needed in "dot down"
situations. The curly brace
syntax is being used for both binding and
"_expression_ evaluation"
So, if you are referencing foo.bar.baz.boz, you
can often get away
with a binding trigger on a prefix of the
_expression_, (e.g., foo.bar)
and then evaluating the rest without binding
(e.g., .baz.bar). That
is, it is often the case that baz and boz change
if and only if foo
or bar changes (and that flex knows the types of
foo and bar) I
suspect this is true in most deeply nested
"dot down" situations.
In this case you can get around the compiler
warning by tricking Flex
to trigger on the prefix.
For example:
public static function
bindingFixer(object:Object) : Object {
return
object;
}
<mx:Label
text="{Util.bindingFixer(foo.bar).baz.buz}"/>
The function call is enough to cause flex to
trigger binding on
foo.bar alone, but the _expression_ is evaluated
more/less as
foo.bar.baz.buz.
Is this worthy of incorporation into the FAQ?
--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com
YAHOO! GROUPS LINKS