1 Reply Latest reply on Jul 1, 2010 10:03 PM by Kartik Mehta

    Parent Objects

    DazFaz Level 1

      Hi,

       

      Here is my problem.

       

      var myparentObect = new Object()

       

      var parentsName:String = "my name is bob"

       

      myparentObect = new getParentsName()

       

      //-------------------------------------------

      class getParentsName{

      public function getParentsName(){

           trace("get parent objects name "+this._parent.parentsName)//     undefined

      }

      }

      //-------------------------------------------

       

      The question is how can I get the parent objects name?

       

      Any help here would be very much appreciated.

       

      Thanks in advance

        • 1. Re: Parent Objects
          Kartik Mehta Level 3

          Hi,

           

          You can try this solution :-

           

          var myparentObect = new Object()

           

          var parentsName:String = "my name is bob"

           

          myparentObect = new getParentsName(this)

           

          //-------------------------------------------

          class getParentsName{

          public function getParentsName(root){

               trace("get parent objects name "+root.parentsName)//    my name is bob

          }

          }

          //-------------------------------------------