title: AS3 Passing Variable Parameters to a generic Function Menu / SubItems
body: <p>I'm no code genius, but a fan of action script.
  Can you help me on this:</p>
  
  <p>I have a function that depending on the object selected, will call event listeners to a set of 'sub-items' that are already on stage (I want to reuse this subitems with changed parameters upon click, instead of creating several instances and several code).</p>
  
  <p>So for each selected 'case' I have to pass diferent variables to those 'sub-items', like this:</p>
  
  <pre><code>function fooMenu(event:MouseEvent):void {
      switch (event.currentTarget.name)
      {
          case "btUa1" :
              trace(event.currentTarget.name);
              // a bunch of code goes here
              //(just cleaned to easy the view)
              /*
              HELP HERE &lt;--
              here is a way to pass the variables to those subitems
              */
  
              break;
      }
  }
  
  function fooSub(event:MouseEvent):void
  {
      trace(event.target.data);
      trace(event.currentTarget.name);
      // HELP PLEASE &lt;-&gt; How can I access the variables that I need here ?
  }
  
  btUa1.addEventListener(MouseEvent.CLICK, fooMenu);
  btUa2.addEventListener(MouseEvent.CLICK, fooMenu);
  
  btTextos.addEventListener(MouseEvent.CLICK, fooSub);
  btLegislacao.addEventListener(MouseEvent.CLICK, fooSub);
  </code></pre>
  
  <p>Anyone to help me please?
  Thank very much in advance. :)</p>