2 Replies Latest reply on Jul 28, 2009 12:03 PM by _Natasha_

    Object always returns null

    mfsiddiq Level 1

      I have an Object within another Object.Whenever i try to access the Object inside i get "null object",even though in the debug mode i am able to see it has valid entries.

       

      My Object structure is as follows:

      [1] Object (@30c0c19)

      innerDataObj Object (@30c0d09)

      firstAttr""

      secondAttr"Second"

      thirdAttr"Third"

      foruthAttr"Fourth"

      fifthAttr"Fifth"

       

      I am trying to access the innerObject using obj.innerDataObj or obj['innerDataObj'],but both are returning null.

       

      Has anyone come across such issue

       

      Regards

      Sidd

       

        • 1. Re: Object always returns null
          Gregory Lafrance Level 6

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

           

          <?xml version="1.0" encoding="utf-8"?>
          <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
            creationComplete="init();">
            <mx:Script>
              <![CDATA[
                private function init():void{
                  var obj:Object = {
                    innerDataObj: {
                      firstAttr: "",
                      secondAttr: "Second",
                      thirdAttr: "Third",
                      fourthAttr: "Fourth",
                      fifthAttr: "Fifth"
                    }
                  };        
                  trace(obj.innerDataObj.firstAttr);     
                  trace(obj.innerDataObj.secondAttr);    
                  trace(obj.innerDataObj.thirdAttr);     
                  trace(obj.innerDataObj.fourthAttr);    
                  trace(obj.innerDataObj.fifthAttr);     
                }
              ]]>
            </mx:Script>
          </mx:Application>

          • 2. Re: Object always returns null
            _Natasha_ Level 4

            Hi,

            may be try to access this property before creation? Check it or post a code.