我继承了一个 Adobe AIR 应用程序,并试图通过 Flash Builder 4.5 对其进行调试。在 Flash Builder 中,当我查看其中一个 MXML 文件时,我看到每次使用 [Bindable]
标签时都会收到警告:
[Bindable]
internal var selectedPreviousID:String=null;
[Bindable]
internal var recent:mx.collections.ArrayCollection;
警告是:
Access of undefined property Bindable
有一个我认为是合适的库的导入:
import mx.binding.utils.*;
并且根据 this blog post 中的建议,每个警告之前的行中没有缺少分号.
该项目配置为使用 Flex SDK 3.6。
此外,该文件不会在设计器中加载,并出现以下警告:
Design mode: Error during component layout. Choose Design > Refresh to refresh design mode.
我错过了什么?在运行时,我看到一个空白窗口 - 我认为这是未触发绑定(bind)的结果。这个标签在 Flex SDK 3.6 中不可用吗?
最佳答案
通过一个一个地从代码中删除元素,我发现警告似乎是由 <mx:WebService>
引起的。前面的元素声明:
<mx:WebServiceid="service"
wsdl="https://blah.com/blah?WSDL"
operations='{{"Op1":this.method1()}}'/>
</mx:WebService>
具体来说,如果我删除内联“operations”属性 - 那么针对 Bindable 的警告就会消失。一定是触发了解析器的一些问题。
进一步的测试表明任何使用内联属性语法的属性,例如:
properties='{{"outerDocument":this}}'
触发此解析器问题。此代码是由反编译器生成的,因此可能是无效的。
有一种替代语法可以将操作指定为 XML 节点而不是属性:
<mx:WebServiceid="service"
wsdl="https://blah.com/blah?WSDL"/>
<mx:operation name="Op1" result="this.method1(event)">
<mx:request>
<token>{credentials.token}</token>
</mx:request>
</mx:operation>
</mx:WebService>
关于apache-flex - 闪存生成器 : "Access of undefined property Bindable",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6216797/