Error #1065: 变量 未定义 global/flash.utils::getDefinitionByName()(三)

2014-11-24 08:53:16 · 作者: · 浏览: 1
ild()[C:\autobuild\3.2.0\frameworks\projects\framework\src\mx\core\Container.as:2140] at mx.core::Container/createComponentFromDescriptor()[C:\autobuild\3.2.0\frameworks\projects\framework\src\mx\core\Container.as:3681] at mx.core::Container/createComponentsFromDescriptors()[C:\autobuild\3.2.0\frameworks\projects\framework\src\mx\core\Container.as:3493] at mx.core::Container/createChildren()[C:\autobuild\3.2.0\frameworks\projects\framework\src\mx\core\Container.as:2589] at mx.core::UIComponent/initialize()[C:\autobuild\3.2.0\frameworks\projects\framework\src\mx\core\UIComponent.as:5370] at mx.core::Container/initialize()[C:\autobuild\3.2.0\frameworks\projects\framework\src\mx\core\Container.as:2526] at mx.core::Application/initialize()[C:\autobuild\3.2.0\frameworks\projects\framework\src\mx\core\Application.as:846] at CloudRandomForest/initialize()[E:\fansy_work\project\caic-ria\src\CloudRandomForest.mxml:0] at mx.managers::SystemManager/http://www.adobe.com/2006/flex/mx/internal::childAdded()[C:\autobuild\3.2.0\frameworks\projects\framework\src\mx\managers\SystemManager.as:2009] at mx.managers::SystemManager/initializeTopLevelWindow()[C:\autobuild\3.2.0\frameworks\projects\framework\src\mx\managers\SystemManager.as:3234] at mx.managers::SystemManager/http://www.adobe.com/2006/flex/mx/internal::docFrameHandler()[C:\autobuild\3.2.0\frameworks\projects\framework\src\mx\managers\SystemManager.as:3064] at mx.managers::SystemManager/docFrameListener()[C:\autobuild\3.2.0\frameworks\projects\framework\src\mx\managers\SystemManager.as:2916] TypeError: Error #1009: 无法访问空对象引用的属性或方法。 at mx.containers::Panel/commitProperties()[C:\autobuild\3.2.0\frameworks\projects\framework\src\mx\containers\Panel.as:1159] at mx.core::UIComponent/validateProperties()[C:\autobuild\3.2.0\frameworks\projects\framework\src\mx\core\UIComponent.as:5807] at mx.managers::LayoutManager/validateProperties()[C:\autobuild\3.2.0\frameworks\projects\framework\src\mx\managers\LayoutManager.as:539] at mx.managers::LayoutManager/doPhasedInstantiation()[C:\autobuild\3.2.0\frameworks\projects\framework\src\mx\managers\LayoutManager.as:659] at Function/http://adobe.com/AS3/2006/builtin::apply() at mx.core::UIComponent/callLaterDispatcher2()[C:\autobuild\3.2.0\frameworks\projects\framework\src\mx\core\UIComponent.as:8628] at mx.core::UIComponent/callLaterDispatcher()[C:\autobuild\3.2.0\frameworks\projects\framework\src\mx\core\UIComponent.as:8568]
这个错误在09年就有人提出来了,链接为:http://www.iteye.com/problems/27570,和我的错误一样。

下面是一个相对合理的解释。

针对一个MXML文件:

方式一: private var myId:String ; 或者 [Bindable] private var myId:String ;

方式二: private var myId:String =""; 或者 [Bindable] private var myId:String ="";

方式三: private var myId:String = null; 或者 [Bindable] private var myId:String = null;

这三种方式都不行;

可以使用的是 在前面加上// 也就是把它们去掉,这里需要郑重说明的一点是 myId变量在整个页面的其他地方没有用到,所以才出现了这个问题。纠结呀,搞了好久,才发现这个问题。如果在下面的界面中用到了myId这个变量,那么就不会出现这个问题了。看来编程也不是随便的复制别人的代码,还要每个变量都推敲一下呀。


分享,成长,快乐

转载请注明blog地址:http://blog.csdn.net/fansy1990