0 Replies Latest reply on Aug 12, 2008 2:49 PM by BreckDesign

    using a keyListener to draw with arrow keys

    BreckDesign
      Hi!

      I am trying to create an interactive game where the user can draw a line using the arrow keys (similar to an etch-a-sketch). I have a start point acting on keyListeners that will move around the screen using the arrow keys, but I can't seem to figure out how to get the listeners to draw a line. Here is the correct code that moves the start point:

      information_txt.text = "USE YOUR ARROW KEYS TO DRAW";
      var speed:Number = 4;
      start_mc.onEnterFrame = function() {
      if (Key.isDown(Key.RIGHT)) {
      this._x = this._x+speed;
      } else if (Key.isDown(Key.LEFT)) {
      this._x = this._x-speed;
      }
      if (Key.isDown(Key.UP)) {
      this._y = this._y-speed;
      } else if (Key.isDown(Key.DOWN)) {
      this._y = this._y+speed;
      }
      };

      How can I modify Action Script to get the keyListeners to draw on the arrow keys?
      Any help would be MUCH appreciated!!!

      Thanks!