无法解决 Flex builder 3 中的此编译错误
我是使用 Flex Builder 3 进行新的 Web 应用程序开发,目前我面临以下问题:
附件是 mxml 文件中的代码片段:
<mx:Script>
<![CDATA[
import com.bx.Char10;
import com.bx.A;
[Bindable] private var inputParam:A = new A()
inputParam.CustNumber.char10 = '0123456789'
}
]]>
</mx:Script>
这会产生编译错误
1120 访问未定义的属性 inputParam
但是,如果我替换
inputParam.CustNumber.char10 = '0123456789'
为
private function set():void
{
inputParam.CustNumber.char10 = '0123456789'
}
编译错误就会消失。
我的问题是: 如何在不使用我所做的解决方法的情况下消除此编译错误?
I am new Web App development using Flex Builder 3 and currently I am facing the following problem:
Attached is a code snippet from the mxml file:
<mx:Script>
<![CDATA[
import com.bx.Char10;
import com.bx.A;
[Bindable] private var inputParam:A = new A()
inputParam.CustNumber.char10 = '0123456789'
}
]]>
</mx:Script>
This Gives a compile error
1120 Access of undefined property inputParam
However if I replace
inputParam.CustNumber.char10 = '0123456789'
with
private function set():void
{
inputParam.CustNumber.char10 = '0123456789'
}
The compile error goes away.
My Question is :
How can I remove this Compilation Error without using the workaround I did?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
嗯,我不相信可以直接在类体内执行任意语句。 (“Script”标签的内容被视为直接位于类主体内)。
仅允许函数定义或变量属性定义。
另一种解决方法是通过您感兴趣的变量属性的构造函数传递信息。
Hmm, I don't believe that one can execute arbitrary statements directly inside a class body. (The "Script" tag's contents are treated as if they were directly inside the class body).
Only function definitions or variable property definitions are allowed.
A different work-around to use is to pass the information through the constructor of the variable property you're interested in.