title: Using multiple classes to control a character
body: <p>I am trying to create a virtual pet/basic Sims type game.
  I am to use independent class files and call them in the main game file.
  I am trying to write a class to control my character and I can add it to the stage, but cannot for the life of me make it move.
  I have just spent 4 hours watching tutorials, reading books and just cannot see what I am missing.
  Can anyone offer me some advice on getting this to work?
  Here is my code ...</p>
  
  <p>This is my main class ...</p>
  
  <pre><code>package {
  
      import flash.display.MovieClip;
      import MainCharacter;
      import flash.events.KeyboardEvent;
  
      public class Tamagotchi extends MovieClip {
  
          public function Tamagotchi() {
              var item:MainCharacter = new MainCharacter();
              addChild(item);
              item.addEventListener(KeyboardEvent.KEY_DOWN, item.KeyPressListener);
          }
  
      }
  }
  </code></pre>
  
  <p>This is the character class ...</p>
  
  <pre><code>package {
  
      import flash.display.MovieClip;
      import flash.events.KeyboardEvent;
      import flash.events.Event;
      import flash.events.MouseEvent;
  
      public class MainCharacter extends MovieClip {
  
          var soph: MovieClip = new SophRun;
  
          public function MainCharacter() {
              addChild(soph);
              soph.x = 200;
              soph.y = 300;      
              soph.addEventListener(KeyboardEvent.KEY_DOWN, KeyPressListener);
          }
  
          public function KeyPressListener(e:KeyboardEvent):void {
              if (e.keyCode == 65)
              {
                  soph.x -= 2;
              }
              if (e.keyCode == 68)
              {
                  soph.x += 2;
              }
              if (e.keyCode == 87)
              {
                  soph.y -= 2;
              }
              if (e.keyCode == 83)
              {
                  soph.y += 2;
              }
          }
  
      }
  }
  </code></pre>
  
  <p>I have moved the eventlistener to multiple places and still cannot get it working.
  I am guessing I am missing something obvious, but cannot figure out what!</p>