可绑定变量无法分配给其他变量

时间:2012-10-20 16:37:30

标签: flex

为什么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;”不工作,不预先选择任何dataGrid。还有其他方法可以使它发挥作用吗?

0 个答案:

没有答案