13 Replies Latest reply on May 26, 2011 2:41 PM by cpthk

    How to access an element using its name or id if it is not a class variable?

    cpthk

      I am trying to retrieve the element I added to my UI in a different  function. I am using actionscript 3. I know I can put the variable into a  class variable, so it can be access anywhere in the class, but I have  too many elements. Is there anyway I could access them without putting  them into class variable?

      Thanks.

       

       

      public class Test extends SkinnableContainer{
      
      // private var image:Image; <-- I try not to do this, too messy
      
      private function func1() {
          var image:Image = new Image();
          addElement(image);
      }
      
      
      private function func2() {
          var image:Image = /* how to get the element from my UI without putting into class variable */
      }