title: AS3 Object Bin and Reset Button
body: <p>I am trying to create a game for kids where they can drag letters on to a stage to make words.</p>
  
  <p>I want to add a 'trash can' where users can drag letters they no longer need to dispose of them. I have created the movie clip but am totally unsure how to make it function using AS3.</p>
  
  <p>I would also like to add a reset button so that the stage reverts to it's original state. Again, I have drawn it up and added the little as3 that I am aware of (to make it a button) but if anyone could assist with how to actually make this happen, I would be grateful.</p>
  
  <p>The files are here: <a href="http://www.jamesjardine.net/ict/wordwork.swf" rel="nofollow">SWF</a> | <a href="http://www.jamesjardine.net/ict/wordwork.fla" rel="nofollow">FLA</a> and the code for the game is as follows:</p>
  
  <pre><code>import flash.display.MovieClip;
  
  for (var i=1; i&lt;27; i++)
  {
      this["object" + i].addEventListener(MouseEvent.MOUSE_DOWN, onStart);
      this["object" + i].addEventListener(MouseEvent.MOUSE_UP, onStop);
  }    
  
  var sx = 0,sy = 0;
  
  function onStart(e)
  {
      sx = e.currentTarget.x;
      sy = e.currentTarget.y;
      e.currentTarget.startDrag();
  }
  
  function onStop(e)
  {
      if ( e.target.dropTarget != null &amp;&amp; 
           e.target.dropTarget.parent == dest &amp;&amp; 
           e.currentTarget.name != "copy" )
      {
          var objectClass:Class = 
          getDefinitionByName(getQualifiedClassName(e.currentTarget)) as Class;
  
          var copy:MovieClip = new objectClass();
          copy.name = "copy"; 
          this.addChild(copy);
          copy.x = e.currentTarget.x;
          copy.y = e.currentTarget.y;
  
          e.currentTarget.x = sx;
          e.currentTarget.y = sy;
  
          copy.addEventListener(MouseEvent.MOUSE_DOWN, onStart);
          copy.addEventListener(MouseEvent.MOUSE_UP, onStop);
      }       
      e.currentTarget.stopDrag();
  }
  
  
  resetButton.addEventListener(MouseEvent.CLICK, reset);
  resetButton.buttonMode = true;
  
  function reset(event:MouseEvent):void
  {
  
  //Not sure what AS3 to add here to reset to original state
  
  }
  </code></pre>