title: AS3 - How do I get the name of the object in an event handler function?
body: <p>Below is my AS3 code:</p>
  
  <pre><code>    public function load_swfs(event:Event)
      {
          var loader:Loader = event.target.getChildAt(0) as Loader;
          var mc:MovieClip = loader.content as MovieClip;
          var mc_name = 'somethingGeneratedElsewhere';
          this.animations[mc_name] = mc;
      }
  
      // --------------------------------------------------------------------
      public function add(mc_name)
      {
          //this.animations is a object that holds a bunch of dynamically loaded SWF files.
          addChild(this.animations[mc_name]);
          this.animations[mc_name].addEventListener(Event.ENTER_FRAME, enter_frame_handler);
      }
  
      // --------------------------------------------------------------------
      public function enter_frame_handler(e:Event)
      {
         //how do I get mc_name in this function
         // Example, if I run add('movie123'). How do I get 'movie123' in this function?
      }
  </code></pre>
  
  <p>If I run add('movie123'). How do I get the string 'movie123' in the enter_frame_handler function?</p>
  
  <p><strong>UPDATE</strong></p>
  
  <p>This forum post (<a href="http://www.actionscript.org/forums/showthread.php3?t=179758" rel="nofollow">Click Here</a>) describes the issues I am having but doesn't provide the solution I am looking for. Luckily @kapep provided a simple solution that solved the issue.</p>