0 Replies Latest reply on Sep 12, 2007 8:21 PM by d2army

    How to grab a MovieClip's child in ActionScript 2.0?

    d2army
      Hi there,

      so I have created a Flash Symbol with several UIComponents in there, such as Button, TextArea, Window, etc. For the Properties of this Symbol, I link it to a class named ObjWindow

      I then defined ObjWindow in a separate AS file , such as below(simplified). What I am stuck at is trying to access the children of the symbol(MovieClip) from within the class. I have been able to fetch the children using the "this" or "_root" variables, but the type of the children will always be MovieClips, regardless of whether they are originally Buttons, TextAreas, etc.


      import mx.controls.TextArea ;
      import mx.controls.Button ;

      class ObjWindow extends MovieClip
      {
      private var But:Button ;
      private var Text:TextArea ;

      function ObjWindow()
      {
      //Grabbing the children of the Symbol
      But = this["name of button"] ; //But will become a MovieClip
      Text = this["name of textarea"] ; //Becomes MovieClip too
      }
      }


      I found this function called getChildByName online and it doesn't seem to be available for ActionScript 2 unfortunately.

      Please help, thanks