为什么 productitem.idProduct 的值不能赋值给变量 Ai?
[Bindable] public var productitem:Object;
public function dataGrid_creationCompleteHandler(event:FlexEvent):void
{
var Ai:int = productitem.idProduct;
getAllPorductstatushistoryResult.token = porductstatushistoryService.getAllPorductstatushistory();
getPorductitemhistoryProductIDResult.token = porductstatushistoryService.getPorductitemhistoryProductID(Ai);
}
并且错误堆是
TypeError:错误 #1009:无法访问空对象引用的属性或方法。
at productDetailComp/dataGrid_creationCompleteHandler()[C:\Users\School\Adobe Flash Builder 4.6\FYPadminSideV3\src\productDetailComp.mxml:153]
at productComp/productdataGridItemSelect()[C:\Users\School\Adobe Flash Builder 4.6\FYPadminSideV3\src\productComp.mxml:56]
at productComp/refreshApp_product()[C:\Users\School\Adobe Flash Builder 4.6\FYPadminSideV3\src\productComp.mxml:73]
at productComp/___productComp_Group1_creationComplete()[C:\Users\School\Adobe Flash Builder 4.6\FYPadminSideV3\src\productComp.mxml:9]
第153行是行
var Ai:int = productitem.idProduct;
第56行是行
pC.dataGrid_creationCompleteHandler(e);
第 73 行是行
productdataGridItemSelect(e);
这是一部分
protected function productdataGridItemSelect(event:GridSelectionEvent):void
{
ProductDetailComp.productitem=productdataGrid.selectedItem;
var pC:productDetailComp = new productDetailComp();
var e:FlexEvent;
pC.dataGrid_creationCompleteHandler(e);
}
public function refreshApp_product( ):void{
//var productdataGrid:Object;
//productdataGrid.selectedIndex = 5;
productdataGrid.selectedIndex = 0;
var e:GridSelectionEvent;
productdataGridItemSelect(e);
}
第一个问题是为什么函数会停在那里?另一个问题是“productdataGrid.selectedIndex = 0;” 不工作,也没有预先选择任何数据网格。有没有其他方法可以让它工作?