5 Replies Latest reply on May 1, 2008 4:44 PM by kglad

    Containing Mouse Drawing Movement

    JOliver77 Level 1
      Hello,

      I'm creating a 'white board' file.. where the mouse cursor changes to a pencil, and the user can use it to write on the 'white board'. I've got it working in principal.. however I'd like to contain the area of the 'white board', as currently the user can scribble all over the page. I'm currently useing this code to make things work:

      startDrag("mousePen",true);
      mousePen.swapDepths(2);
      Mouse.hide();
      this.createEmptyMovieClip("line",1);

      this.onMouseDown = function() {
      line.moveTo(_xmouse,_ymouse);
      line.lineStyle(2,0x333333,100);

      this.onMouseMove = function() {
      line.lineTo(_xmouse,_ymouse);
      updateAfterEvent();
      }
      }
      this.onMouseUp = function() {
      this.onMouseMove = null;
      }


      The area I want to constrain to is 130 x 190. I've played with hitTest but couldn't make it work, and also tried to constrain the mouse Drag with:

      startDrag(this, true, 1, 1, 1, 1); - NB co-ords not correct.

      This work to constrain the mouse drag, but the pencil line drawing continues without the pencil cursor attached.

      I know I'm close but just cant work it out.. can anyone offer any advice?

      Many thanks in advance.