最近Flexと格闘している。だいぶ勉強したけどまだまだエラーが意味不明でギギギ。
特に意味不明だったのが、表題の通りXMLの属性取得時に出るワーニング。
Unable to bind to property "prop" on class "XML" (class is not an IEventDispatcher)
具体的には、Labelオブジェクトに{data.data.@prop}みたいな感じで指定すると描画される度に出てうざい。要はBindableにすればいいんだと思うんだけど、属性だしなあ・・・。
でも、ググってみたらちゃんと解決方法が見つかった。
Object doesn"t dispatch events. Although you have made the variable Bindable, the properties of the object referenced by the variable currentLink can not be bound.
Use ObjectProxy instead.
Flex Warning: Unable to bind to property ‘foo’ on class ‘Object’ (class is not an IEventDispatcher) - Stack Overflow
なるほど!というかObjectProxyって初めて聞いた!
ということで、
[Bindable] private var proc: ObjectProxy; : : proc = new ObjectProxy(data.data); : : label.text = proc.@prop;
とすることでwarningを回避できた。勿論ラベルのtextプロパティに{proc.@prop}としてもオッケー。