1 Reply Latest reply on Jan 3, 2011 8:52 AM by Gregory Lafrance

    Cannot access a property or method of a null object reference coming for First Time

    kiran7881 Level 1

      Hi ,

       

      I have Four Components , Two textInputs and two Date Fields .
      Where My requirement is to display enetred TextInputs in one Line and display DateFileds selected in a Another line on to a Text Area.

       

       

       

       

       

        <mx:Canvas label="Datebase Search" toolTip="Datebase Search">

          <mx:TextInput id="FromTI" x="85" width="373" change="enterContext()" />
          <mx:TextInput id="ToTI" x="85" y="33" width="100%" change="enterContext()" />

          <mx:DateField id="AfterDF" x="80" y="17"/>
          <mx:DateField id="toDF" x="80" y="56"/>

        </mx:Canvas>

       

       

      I tried this way :

       

      Application.application.myTA.text = FromTI.text+" "+ToTI.text +"\n"+AfterDF.text+" "+toDF.text;

       


      The Problem is taht , I am getting this Error , whenever  I entered something on to the TextField FromTI (This is only coming for the First Time )

       

      Could anybody please help me , Thanks .

        • 1. Re: Cannot access a property or method of a null object reference coming for First Time
          Gregory Lafrance Level 6

          As a first step, I would do the following, to see which is null:

           

          if(Application.application.myTA == null){

              trace("Application.application.myTA");

          }

          if(FromTI == null){

              trace("FromTI");

          }

          if(Application.application.myTA == null){

              trace("ToTI");

          }

          if(Application.application.myTA == null){

              trace("AfterDF");

          }

          if(Application.application.myTA == null){

              trace("toDF");

          }

           

          However, if any of these referenced components are in the non-first view of a ViewStack, Accordion, or TabBar, and that navigator container does not have creationPolicy="all", then this will likely occur.

           

          If this post answers your question or helps, please mark it as such. Thanks!

          http://www.chikaradev.com
          Adobe Flex Development and Support Services