11 Replies Latest reply on Dec 4, 2007 6:23 AM by Chuckon

    Null Object Reference Error

      I receive a

      TypeError: Error #1009: Cannot access a property or method of a null object reference.
      at managers::ProductionLineManagement/productionAreaLabel()
      at mx.controls.dataGridClasses::DataGridColumn/itemToLabel()
      at mx.controls.dataGridClasses::DataGridBase/mx.controls.dataGridClasses:DataGridBase::makeL istData()
      at mx.controls.dataGridClasses::DataGridBase/mx.controls.dataGridClasses:DataGridBase::makeR owsAndColumns()
      at mx.controls::DataGrid/mx.controls:DataGrid::makeRowsAndColumns()
      at mx.controls.listClasses::ListBase/mx.controls.listClasses:ListBase::updateDisplayList()
      at mx.controls::DataGrid/mx.controls:DataGrid::updateDisplayList()
      at mx.core::UIComponent/validateDisplayList()
      at mx.managers::LayoutManager/::validateDisplayList()
      at mx.managers::LayoutManager/::doPhasedInstantiation()
      at Function/ http://adobe.com/AS3/2006/builtin::apply()
      at mx.core::UIComponent/::callLaterDispatcher2()
      at mx.core::UIComponent/::callLaterDispatcher()

      error in a random basis occurrence. What I mean is that the error could no occur at all or it can be, sometimes the application works without problems, sometimes it does not work at all. Just refreshing the browser might fix it or might not.

      It happens on the labelFunction function of one of the DataGridColumns of a Datagrid, the DataGrid is specified like

      <mx:DataGridColumn dataField="productionArea" labelFunction="productionAreaLabel" width="120" headerText="Production Area" minWidth="120"/>

      and the labelFunction is

      public function productionAreaLabel(item:Object, dataField:DataGridColumn):String
      return String(productionAreas.getItemAt(int(item.productionArea) - 1));

      Where I use an Array of Strings called productionAreas.

      It is really a weird error for me specially when it happens randomly. I'd appreciate any help on this. Thanks a lot