1、错误描述
ReferenceError: Error #1065: 变量 dataGridArray 未定义。 at global/flash.utils::getDefinitionByName() at mx.utils::DescribeTypeCache$/describeType()[E:\dev\4.0.0\frameworks\projects\framework\src\mx\utils\DescribeTypeCache.as:106] at mx.utils::ObjectUtil$/getClassInfo()[E:\dev\4.0.0\frameworks\projects\framework\src\mx\utils\ObjectUtil.as:932] at mx.controls::DataGrid/generateCols()[E:\dev\4.0.0\frameworks\projects\framework\src\mx\controls\DataGrid.as:2753] at mx.controls::DataGrid/collectionChangeHandler()[E:\dev\4.0.0\frameworks\projects\framework\src\mx\controls\DataGrid.as:4633] at mx.controls.listClasses::ListBase/set dataProvider()[E:\dev\4.0.0\frameworks\projects\framework\src\mx\controls\listClasses\ListBase.as:2258] at mx.controls::DataGrid/set dataProvider()[E:\dev\4.0.0\frameworks\projects\framework\src\mx\controls\DataGrid.as:1640] at mx.core::Container/createComponentFromDescriptor()[E:\dev\4.0.0\frameworks\projects\framework\src\mx\core\Container.as:4285] at mx.core::Container/createComponentsFromDescriptors()[E:\dev\4.0.0\frameworks\projects\framework\src\mx\core\Container.as:4160] at mx.core::Container/createChildren()[E:\dev\4.0.0\frameworks\projects\framework\src\mx\core\Container.as:3187] at mx.core::UIComponent/initialize()[E:\dev\4.0.0\frameworks\projects\framework\src\mx\core\UIComponent.as:7250] at mx.core::Container/initialize()[E:\dev\4.0.0\frameworks\projects\framework\src\mx\core\Container.as:3129] at mx.core::UIComponent/http://www.adobe.com/2006/flex/mx/internal::childAdded()[E:\dev\4.0.0\frameworks\projects\framework\src\mx\core\UIComponent.as:7142] at mx.core::UIComponent/addChildAt()[E:\dev\4.0.0\frameworks\projects\framework\src\mx\core\UIComponent.as:6848] at spark.components::Group/addDisplayObjectToDisplayList()[E:\dev\4.0.0\frameworks\projects\spark\src\spark\components\Group.as:1825] at spark.components::Group/http://www.adobe.com/2006/flex/mx/internal::elementAdded()[E:\dev\4.0.0\frameworks\projects\spark\src\spark\components\Group.as:1416] at spark.components::Group/setMXMLContent()[E:\dev\4.0.0\frameworks\projects\spark\src\spark\components\Group.as:512] at spark.components::Group/set mxmlContent()[E:\dev\4.0.0\frameworks\projects\spark\src\spark\components\Group.as:452] at spark.components::SkinnableContainer/set mxmlContent()[E:\dev\4.0.0\frameworks\projects\spark\src\spark\components\SkinnableContainer.as:604] at spark.components::SkinnableContainer/createDeferredContent()[E:\dev\4.0.0\frameworks\projects\spark\src\spark\components\SkinnableContainer.as:986] at spark.components::SkinnableContainer/createContentIfNeeded()[E:\dev\4.0.0\frameworks\projects\spark\src\spark\components\SkinnableContainer.as:1014] at spark.components::SkinnableContainer/createChildren()[E:\dev\4.0.0\frameworks\projects\spark\src\spark\components\SkinnableContainer.as:827] at mx.core::UIComponent/initialize()[E:\dev\4.0.0\frameworks\projects\framework\src\mx\core\UIComponent.as:7250] at componts::WinDrag/initialize() at mx.managers.systemClasses::ChildManager/childAdded()[E:\dev\4.0.0\frameworks\projects\framework\src\mx\managers\systemClasses\ChildManager.as:189] at mx.managers::SystemManager/http://www.adobe.com/2006/flex/mx/internal::rawChildren_addChildAt()[E:\dev\4.0.0\frameworks\projects\framework\src\mx\managers\SystemManager.as:1963] at mx.managers::SystemManager/addChildAt()[E:\dev\4.0.0\frameworks\projects\framework\src\mx\managers\SystemManager.as:1595] at mx.managers::SystemManager/addChild()[E:\dev\4.0.0\frameworks\projects\framework\src\mx\managers\SystemManager.as:1578] at mx.managers::PopUpManagerImpl/addPopUp()[E:\dev\4.0.0\frameworks\projects\framework\src\mx\managers\PopUpManagerImpl.as:345] at mx.managers::PopUpManagerImpl/createPopUp()[E:\dev\4.0.0\frameworks\projects\framework\src\mx\managers\PopUpManagerImpl.as:236] at mx.managers::PopUpManager$/createPopUp()[E:\dev\4.0.0\frameworks\projects\framework\src\mx\managers\PopUpManager.as:139] at TitleWindow/clickHandler()[D:\Adobe Flash Builder 4 Installer\TitleWindow\src\TitleWindow.mxml:18] at TitleWindow/___TitleWindow_Button1_click()[D:\Adobe Flash Builder 4 Installer\TitleWindow\src\TitleWindow.mxml:30]
2、错误原因
由于dataGridArray 是ArrayCollection类型,在表格中的数据绑定时,dataProvider="dataGridArray",导致出错
3、解决办法
将dataProvider="dataGridArray"修改成dataProvider="{dataGridArray}",注意语法