5 Replies Latest reply on Oct 11, 2006 12:02 PM by tinderstick

    Problems with removing MouseListener

    tinderstick
      Hello Everyone,

      Little explanation of my problem:

      1) on the main timeline (_root) I have following simple code-snippet:
      There is a MouseListener called mListener:


      mListener = new Object();
      mListener.onMouseMove = function() {
      _x = 50;
      _y = 50;
      speed = 3;

      endX = _root._xmouse;
      endY = _root._ymouse;
      _x -= (endX-_x)/speed;
      _y -= (endY-_y)/speed;

      };

      bg_mc.onEnterFrame = function() {
      Mouse.addListener(mListener);
      };


      2) on a deeper depth there is a button by which I want to remove the above mentioned MouseListener:
      Code is as follows:

      on (release) {
      Mouse.removeListener(_root.bg_mc.mListener);

      }

      BUT THIS CODE DOESN'T WORK ??

      Any ideas?
      Any help would be very appreciated...
      Thanks in advance for your quick reply...

      tinderstick