1 Reply Latest reply on May 27, 2009 10:12 PM by _Natasha_

    How to store the reference of a VBox?

    manofspirit Level 1

      Hello guys

       

      I want to store the "reference" of a Vbox so i could be able to access and use its addChild method from different classes and places.

      How could i do that?

       

      I tried to do something like this, but vain

      I created a Actionscript Class, added a static var myReferences:Object = new Object();

      and then did following

      myReferences["area"] = myVBox;

       

       

      but when i access it from some other area and do something like that, nothing happens

      (myReferences["area"] as VBox).addChild(someStuff);

       

       

      Please guide in this regard

        • 1. Re: How to store the reference of a VBox?
          _Natasha_ Level 4

          Hi,

          it's good when you set id property of control. After that you can give you control be parent["id_of_my_control"].

           

          The way you've described alos should works if you add your VBox to any controls as a child.

          For example,

          var vb:VBox = new VBox();

          vb.id = "myVBox";

          ... // other code

          this.addChild(vb);

           

          // after that

          this["myVBox"].addChild(anotherControl);