1 Reply Latest reply on Jun 23, 2009 7:53 PM by kolban1

    Passing Components as Variables

    Clay Borne Level 1

      Hell All,

      Is it possible to pass a component as a variable for later use?  See, the problem is that I am making a reusable popup function and I will not know which component called it.  I won't even know what type of component called it whether it be a button or a TextInput.  Basically after they make their selection on the popup I want to populate the component that originally called it (or possibly another component).  Thanks

        • 1. Re: Passing Components as Variables


          I don't see any problem at all with passing an Action Script reference to a component as a function parameter.  After all, the component is itself just as Object.  Your challenge will be determining what to "do" with that object when you get it.   The properties to set to "populate" a component vary depending on the type of component.  Some components want their "text" properties set while others may want their "selectedItem" property set (for example).  I think you will have to perform "if" statement tests on the passed in parameter using the "is" operation to determine what kind of component it is and then populate it appropriately for its type.