             request.useWeakReference = useWeakReference;
 		    if (!dispatchEvent(request))
 			    return;
+        }
+
+        if (type == SandboxMouseEvent.MOUSE_UP_SOMEWHERE)
+        {
+            // If someone wants this event, also listen for mouseLeave.
+            // Use weak listener because we don't always know when we
+            // no longer need this listener
+            try
+            {
+			    if (stage)
+			    {
+				    stage.addEventListener(Event.MOUSE_LEAVE, mouseLeaveHandler, false, 0, true);
+                }
+                else
+                {
+					super.addEventListener(Event.MOUSE_LEAVE, mouseLeaveHandler, false, 0, true);
+                }
+			}
+			catch (error:SecurityError)
+			{
+				super.addEventListener(Event.MOUSE_LEAVE, mouseLeaveHandler, false, 0, true);
+			}
         }
 		
 		// These two events will dispatched to applications in sandboxes.

											  priority:int = 0,
											  useWeakReference:Boolean = false):void
	{
        if (hasEventListener("addEventListener"))
        {
            var request:DynamicEvent = new DynamicEvent("addEventListener", false, true);

		    dispatchEvent(dynamicEvent);
        }
    }

    /**
     *  @private
     *  dispatch certain stage events from sandbox root
     */
    private function stageEventHandler(event:Event):void
    {
        if (event.target is Stage)
            dispatchEvent(event);
    }

    /**
     *  @private
     *  convert MOUSE_LEAVE to MOUSE_UP_SOMEWHERE
     */
    private function mouseLeaveHandler(event:Event):void
    {
        dispatchEvent(new SandboxMouseEvent(SandboxMouseEvent.MOUSE_UP_SOMEWHERE));
    }

}

}
