  * 
  *  @playerversion AIR 1.1
  */
-public class WindowedSystemManager extends MovieClip implements ISystemManager, ISystemManager2
+public class WindowedSystemManager extends MovieClip implements ISystemManager, ISystemManager2, IParentAccess
 {
 	
 	public function WindowedSystemManager(rootObj:IUIComponent)

		myWindow.nativeWindow.addEventListener("close", cleanup);
	}
}
}
			g.endFill();
		}
	}

		// VERSION_SKEW
	/**
	 * @private
	 * 
	 * true if dispatching a mouse bridge event. We don't want to 
	 * handle our own event.
	 */
	private var isDispatchingBridgeMouseEvent:Boolean;
	
	/**
	 * @private
	 * 
	 * true if redipatching a resize event.
	 */
	 // TODODJL: may be a better of way than dispathing resize event.
	private var isDispatchingResizeEvent:Boolean;
	
	/**
	 * @private
	 * 
	 * Used to locate untrusted forms. Maps string ids to Objects.
	 * The object make be the SystemManagerProxy of a form or it may be
	 * the bridge to the child application where the object lives.
	 */
	private var idToPlaceholder:Object;

	private var eventProxy:EventProxy;
	private var weakReferenceProxies:Dictionary = new Dictionary(true);
	private var strongReferenceProxies:Dictionary = new Dictionary(false);

	//--------------------------------------------------------------------------
	//
	//  Overridden methods: EventDispatcher
	//
	//--------------------------------------------------------------------------

	/**
	 *  @private
	 *  Only create idle events if someone is listening.
	 */
	override public function addEventListener(type:String, listener:Function,
											  useCapture:Boolean = false,
											  priority:int = 0,
											  useWeakReference:Boolean = false):void
	{
		// These two events will dispatched to applications in sandboxes.
		if (type == FlexEvent.RENDER || type == FlexEvent.ENTER_FRAME)
		{
			if (type == FlexEvent.RENDER)
				type = Event.RENDER;
			else
				type = Event.ENTER_FRAME;
				
			try
			{
				// TODODJL: problem loading untrusted children, stage is null and we don't 
				// add the listener we wanted.
				if (stage)
					stage.addEventListener(type, listener, useCapture, priority, useWeakReference);
				else
					super.addEventListener(type, listener, useCapture, priority, useWeakReference);
				
			}
			catch (error:SecurityError)
			{
				super.addEventListener(type, listener, useCapture, priority, useWeakReference);
			}
		
			if (stage && type == Event.RENDER)
				stage.invalidate();

			return;
		}

		if (type == MouseEvent.MOUSE_MOVE || type == MouseEvent.MOUSE_UP || type == MouseEvent.MOUSE_DOWN 
				|| type == Event.ACTIVATE || type == Event.DEACTIVATE)
		{
			// also listen to stage if allowed
			try
			{
				if (stage)
				{
					var newListener:StageEventProxy = new StageEventProxy(listener);
					stage.addEventListener(type, newListener.stageListener, false, priority, useWeakReference);
					if (useWeakReference)
						weakReferenceProxies[listener] = newListener;
					else
						strongReferenceProxies[listener] = newListener;
				}
			}
			catch (error:SecurityError)
			{
			}
		}
		
		if (hasSandboxBridges())
		{
			if (!eventProxy)
				eventProxy = new EventProxy(this);

			var actualType:String = EventUtil.marshalMouseEventMap[type];
			if (actualType)
			{
				addEventListenerToSandboxes(type, sandboxMouseListener, useCapture, priority, useWeakReference);
				
				// Set useCapture to false because we will never see an event 
				// marshalled in the capture phase.
                super.addEventListener(type, listener, false, priority, useWeakReference);
				return;
			}
		}
		
		super.addEventListener(type, listener, useCapture, priority, useWeakReference);
	}
	
	/**
	 * @private
	 * 
	 * Test if this system manager has any sandbox bridges.
	 * 
	 * @return true if there are sandbox bridges, false otherwise.
	 */
	private function hasSandboxBridges():Boolean
	{
		if (sandboxBridgeGroup)
			return true;
		
		return false;
	}
	
	/**
	 *  @private
	 */
	override public function removeEventListener(type:String, listener:Function,
												 useCapture:Boolean = false):void
	{
		// These two events will dispatched to applications in sandboxes.
		if (type == FlexEvent.RENDER || type == FlexEvent.ENTER_FRAME)
		{
			if (type == FlexEvent.RENDER)
				type = Event.RENDER;
			else
				type = Event.ENTER_FRAME;
				
			try
			{
				if (stage)
					stage.removeEventListener(type, listener, useCapture);
				else
					super.removeEventListener(type, listener, useCapture);
			}
			catch (error:SecurityError)
			{
				super.removeEventListener(type, listener, useCapture);
			}
		
			return;
		}

		if (type == MouseEvent.MOUSE_MOVE || type == MouseEvent.MOUSE_UP || type == MouseEvent.MOUSE_DOWN 
				|| type == Event.ACTIVATE || type == Event.DEACTIVATE)
		{
			// also listen to stage if allowed
			try
			{
				if (stage)
				{
					var newListener:StageEventProxy = weakReferenceProxies[listener];
					if (!newListener)
					{
						newListener = strongReferenceProxies[listener];
						if (newListener)
							delete strongReferenceProxies[listener];
					}
					if (newListener)
						stage.removeEventListener(type, newListener.stageListener, false);
				}
			}
			catch (error:SecurityError)
			{
			}
		}

		if (hasSandboxBridges())
		{
			var actualType:String = EventUtil.marshalMouseEventMap[type];
			if (actualType)
			{
				removeEventListenerFromSandboxes(type, sandboxMouseListener, useCapture);
				super.removeEventListener(type, listener, false);
				return;
			}
		}
		
		super.removeEventListener(type, listener, useCapture);
	}

	//--------------------------------------------------------------------------
	//
	//  Overridden methods: DisplayObjectContainer
