 				
 			try
 			{
-			    // Remove both listeners in case the system manager was added
-			    // or removed from the stage after the listener was added.
 				if (stage)
 					stage.removeEventListener(type, listener, useCapture);
-
-					super.removeEventListener(type, listener, useCapture);
             }
             catch (error:SecurityError)
             {
-                super.removeEventListener(type, listener, useCapture);
             }
+			// Remove both listeners in case the system manager was added
+			// or removed from the stage after the listener was added.
+            super.removeEventListener(type, listener, useCapture);
         
             return;
         }
 
         super.removeEventListener(type, listener, useCapture);
+
+		if (type == MouseEvent.MOUSE_MOVE || type == MouseEvent.MOUSE_UP || type == MouseEvent.MOUSE_DOWN 
+				|| type == Event.ACTIVATE || type == Event.DEACTIVATE)
+		{
+            if (!hasEventListener(type))
+            {
+			    // also listen to stage if allowed
+			    try
+			    {
+				    if (stage)
+				    {
+					    stage.removeEventListener(type, stageEventHandler, false);
+				    }
+			    }
+			    catch (error:SecurityError)
+			    {
+			    }
+            }
+		}
+
+        if (type == SandboxMouseEvent.MOUSE_UP_SOMEWHERE)
+        {
+            if (!hasEventListener(SandboxMouseEvent.MOUSE_UP_SOMEWHERE))
+            {
+                // nobody wants this event any more for now
+                try
+                {
+			        if (stage)
+			        {
+				        stage.removeEventListener(Event.MOUSE_LEAVE, mouseLeaveHandler);
+                    }
+			    }
+			    catch (error:SecurityError)
+			    {
+			    }
+			    // Remove both listeners in case the system manager was added
+			    // or removed from the stage after the listener was added.
+			    super.removeEventListener(Event.MOUSE_LEAVE, mouseLeaveHandler);
+            }
+        }
 	}
 
     //--------------------------------------------------------------------------

	override public function removeEventListener(type:String, listener:Function,
												 useCapture:Boolean = false):void
	{
		if (!dispatchEvent(new EventListenerRequest(EventListenerRequest.REMOVE_EVENT_LISTENER_REQUEST, false, true,
						type, listener, useCapture)))
			return;

		// These two events will dispatched to applications in sandboxes.
		if (type == FlexEvent.RENDER || type == FlexEvent.ENTER_FRAME)

import mx.core.Singleton;
import mx.core.IWindow;
import mx.core.mx_internal;
import mx.events.SandboxMouseEvent;
import mx.events.DynamicEvent;
import mx.events.FlexEvent;
import mx.events.EventListenerRequest;
