4 Replies Latest reply on Mar 2, 2007 10:03 PM by ruchir123

    Run time Error #1009: Cannot access a property or method of a null object reference.

    ruchir123
      Hello Gurus,

      Below is the piece of code that creates a combobox control,supplies datasource and handles change events. The problem is when I attempt to chagne the list item, it gives an error during the runtime. I have pasted the code and the error both. Please help.

      code section
      -------------

      <![CDATA[
      private var forChange:Text;
      import flash.events.Event;
      import mx.events.DropdownEvent;
      // Display the type of event for open and close events.
      private function dropEvt(event:DropdownEvent):void {
      forChange.text+=event.type + "\n";
      }
      // Display a selected item's label field and index for change events.
      private function changeEvt(event:Event):void {
      forChange.text+=event.currentTarget.selectedItem.label + " " +
      event.currentTarget.selectedIndex + "\n";
      }
      ]]>
      </mx:Script>

      <mx:ComboBox dataProvider="{country}" x="387" y="290" width="173" id="CombCB" open="dropEvt(event)" close="dropEvt(event)" change = "changeEvt(event)" fontFamily="Arial" fontSize="10" height="23" themeColor="#C9C9C9" >
      </mx:ComboBox>
      //end of code section

      ---------#############ERROR##################-------------

      TypeError: Error #1009: Cannot access a property or method of a null object reference.
      at Coexsys/::dropEvt()
      at Coexsys/__CombCB_open()
      at flash.events::EventDispatcher/flash.events:EventDispatcher::dispatchEventFunction()
      at flash.events::EventDispatcher/dispatchEvent()
      at mx.core::UIComponent/dispatchEvent()
      at mx.controls::ComboBox/ http://www.adobe.com/2006/flex/mx/internal::onTweenEnd()
      at mx.effects::Tween/endTween()
      at mx.effects::Tween/ http://www.adobe.com/2006/flex/mx/internal::doInterval()
      at mx.effects::Tween$/::timerHandler()
      at flash.utils::Timer/flash.utils:Timer::_timerDispatch()

      Really appreciate your time for looking at this posting. Thanks a lot.

      Ruchir