1 Reply Latest reply on Jul 26, 2007 5:52 AM by msabljic

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

    msabljic Level 1
      Situation is this: i have a main .mxml file from which i imported custom component which is basically Accordion with two elements and inside them is TextArea control for each one. I have a function in main .mxml which displays that component as a popUp (using popUp manager class) and populates those two TextArea controls with some text. I can populate first one TextArea just fine but when i try to populate second one the same way i did the first one i get this error:

      TypeError: Error #1009: Cannot access a property or method of a null object reference.
      at SMC/popUp2()
      at SMC/writeToOutput()
      at SMC/___SMC_Button1_click()

      I don't really understand this error and i am not sure what i've done wrong, can someone please help me?

      thank you
        • 1. Error #1009: Cannot access a property or method of a null object reference
          msabljic Level 1
          Here is code from my OutputPopUp.mxml component:

          //////////////////
          <?xml version="1.0" encoding="utf-8"?>
          <mx:TitleWindow xmlns:mx=" http://www.adobe.com/2006/mxml" width="950" height="650" backgroundColor="#444242" showCloseButton="true" creationComplete="popUpCenter();" title="Output" horizontalAlign="center" verticalAlign="middle">

          <mx:Script>
          <![CDATA[

          import mx.managers.PopUpManager;

          public function popUpCenter():void {
          PopUpManager.centerPopUp(this);
          }

          ]]>
          </mx:Script>


          <mx:Accordion id="accordion" width="100%" height="100%">

          <mx:VBox label=".smil output" id="SmilVBOX" width="920" height="557">
          <mx:TextArea id="Text1" wordWrap="true" editable="false" width="920" height="557" backgroundColor="#4A4A4A" color="#FFFFFF"/>
          </mx:VBox>

          <mx:VBox label=".rt output" id="rtVBOX" width="920" height="559">
          <mx:TextArea id="Text2" width="920" height="558" backgroundColor="#4A4A4A" text="Test text" color="#FFFFFF" wordWrap="true" editable="false"/>
          </mx:VBox>

          </mx:Accordion>


          </mx:TitleWindow>
          ////////////////////////////


          And from my main .mxml file i display that component using popUpManager class and try to load string to both TextAreas:

          ///////////////////
          var outputPopUp:OutputPopUp = OutputPopUp (PopUpManager.createPopUp(this, OutputPopUp, true));

          outputPopUp.SmilVBOX.label = odabraniFile2;
          outputPopUp.rtVBOX.label = RTfullPath;

          outputPopUp.Text1.text = "Text1";
          outputPopUp.Text2.text = "Text2"; //this is where i get this error
          //////////////

          but it only works for first one and for second one TextArea displays above error so i am not sure what's going on here?