 	private var idToPlaceholder:Object;
 	
 	private var eventProxy:EventProxy;
+    
+    private var eventProxyRefCounts:Object = {};
 
 	//--------------------------------------------------------------------------
 	//

	{
		var awm:ActiveWindowManager = 
			ActiveWindowManager(systemManager.getImplementation("mx.managers::IActiveWindowManager"));

		// trace("SM: activate " + f + " " + forms.length);
		if (awm.form)
		{
			if (awm.form != event.form && awm.forms.length > 1)

			{
                if (systemManager.getSandboxRoot() == systemManager && eventProxy)
                {
                    if (eventProxyRefCounts[actualType] != null)
                        eventProxyRefCounts[actualType] --;
                    if (eventProxyRefCounts[actualType] == null || eventProxyRefCounts[actualType] == 0)
                    {
                        delete eventProxyRefCounts[actualType];                        
                        Object(systemManager).$removeEventListener(actualType, eventProxy.marshalListener,
                                useCapture);
                        if (actualType == MouseEvent.MOUSE_UP)
                        {
                            try
                            {
                                if (systemManager.stage)
                                    systemManager.stage.removeEventListener(Event.MOUSE_LEAVE, eventProxy.marshalListener,
                                        useCapture);
                            }
                            catch (e:SecurityError)
                            {
                            }
    			            // Remove both listeners in case the system manager was added
    			            // or removed from the stage after the listener was added.
                            Object(systemManager).$removeEventListener(Event.MOUSE_LEAVE, eventProxy.marshalListener,
                                useCapture);
                        }
                    }
                    else
                        return false; // if we didn't actually remove, don't remove on the following lines either
                }
				if (!SystemManagerGlobals.changingListenersInOtherSystemManagers)
					removeEventListenerFromOtherSystemManagers(type, otherSystemManagerMouseListener, useCapture);
