Transferred from the Adobe Open Source Subversion Repository

Revision: 3057
Author:   jimurphy@adobe.com
Date:     2008-09-02T15:18:38.819662Z

Log Message:
-----------
Merged 3.0.x revisions [2966,2969,2995,3004,3018-3019,3023,3029-3030,3046,3049,3052] -> trunk

Modified Paths:
--------------
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/controls/listClasses/TileListItemRenderer.as</path>
<path kind="file" action="D">/flex/sdk/trunk/frameworks/projects/framework/src/mx/events/ModalWindowRequest.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/controls/Menu.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/managers/dragClasses/DragProxy.as</path>
<path kind="dir" action="M">/flex/sdk/trunk</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/managers/PopUpManagerImpl.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/controls/Button.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/controls/ColorPicker.as</path>
<path kind="file" copyfrom-path="/flex/sdk/branches/3.0.x/frameworks/projects/framework/src/mx/events/InterDragManagerEvent.as" copyfrom-rev="3052" action="A">/flex/sdk/trunk/frameworks/projects/framework/src/mx/events/InterDragManagerEvent.as</path>
<path kind="file" action="D">/flex/sdk/trunk/frameworks/projects/framework/src/mx/events/PopUpRequest.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/managers/SystemManagerGlobals.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/events/SWFBridgeEvent.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/managers/systemClasses/EventProxy.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/controls/DateField.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/managers/ISystemManager.as</path>
<path kind="file" action="M">/flex/sdk/trunk/tools/dependencychecker/flex/tools/dependencychecker/FrameworkSwcDependencyRules.java</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/controls/sliderClasses/SliderThumb.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/controls/treeClasses/TreeItemRenderer.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/containers/DividedBox.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/managers/DragManagerImpl.as</path>
<path kind="file" action="D">/flex/sdk/trunk/frameworks/projects/framework/src/mx/events/SizeRequest.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/controls/dataGridClasses/DataGridHeader.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/controls/SWFLoader.as</path>
<path kind="file" copyfrom-path="/flex/sdk/branches/3.0.x/frameworks/projects/framework/src/mx/events/InterManagerRequest.as" copyfrom-rev="3052" action="A">/flex/sdk/trunk/frameworks/projects/framework/src/mx/events/InterManagerRequest.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/airframework/src/mx/managers/NativeDragManagerImpl.as</path>
<path kind="file" action="D">/flex/sdk/trunk/frameworks/projects/framework/src/mx/events/FocusRequest.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/rpc/src/mx/rpc/wsdl/WSDL.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/controls/PopUpButton.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/controls/listClasses/ListBase.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/controls/scrollClasses/ScrollBar.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/containers/dividedBoxClasses/BoxDivider.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/containers/Panel.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/managers/ToolTipManagerImpl.as</path>
<path kind="file" action="D">/flex/sdk/trunk/frameworks/projects/framework/src/mx/events/SandboxRootDragEvent.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/managers/FocusManager.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/airframework/src/mx/managers/WindowedSystemManager.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/controls/ComboBox.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/managers/SystemManager.as</path>
<path kind="file" copyfrom-path="/flex/sdk/branches/3.0.x/frameworks/projects/framework/src/mx/events/SandboxMouseEvent.as" copyfrom-rev="3052" action="A">/flex/sdk/trunk/frameworks/projects/framework/src/mx/events/SandboxMouseEvent.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/controls/listClasses/ListItemRenderer.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/controls/List.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/managers/SystemManagerProxy.as</path>
<path kind="file" action="D">/flex/sdk/trunk/frameworks/projects/framework/src/mx/events/SandboxRootRequest.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/utils/EventUtil.as</path>
<path kind="file" action="D">/flex/sdk/trunk/frameworks/projects/framework/src/mx/events/SandboxRootMouseEvent.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/core/ScrollControlBase.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/controls/DataGrid.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/controls/sliderClasses/Slider.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/controls/dataGridClasses/DataGridItemRenderer.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/managers/CursorManagerImpl.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/events/SWFBridgeRequest.as</path>

git-svn-id: 7146a936b37d36e51ea0d66f8acbe0b8281bc7b7@1261796 13f79535-47bb-0310-9956-ffa450edef68

--- frameworks/projects/framework/src/mx/managers/SystemManager.as
+++ frameworks/projects/framework/src/mx/managers/SystemManager.as
@@ -60,10 +60,6 @@
 import mx.core.TextFieldFactory;
 import mx.core.mx_internal;
 import mx.events.FlexEvent;
-import mx.events.FocusRequest;
-import mx.events.ModalWindowRequest;
-import mx.events.PopUpRequest;
-import mx.events.SizeRequest;
 import mx.messaging.config.LoaderConfig;
 import mx.preloaders.DownloadProgressBar;
 import mx.preloaders.Preloader;
@@ -75,8 +71,8 @@
 import mx.styles.StyleManager;
 import mx.events.EventListenerRequest;
 import mx.events.InvalidateRequestData;
-import mx.events.SandboxRootRequest;
-import mx.events.SandboxRootMouseEvent;
+import mx.events.InterManagerRequest;
+import mx.events.SandboxMouseEvent;
 import mx.events.SWFBridgeRequest;
 import mx.events.SWFBridgeEvent;
 import mx.managers.systemClasses.RemotePopUp;
@@ -1401,20 +1397,20 @@
 			}
 		}

-		if (hasSWFBridges())
+		if (hasSWFBridges() || SystemManagerGlobals.topLevelSystemManagers.length > 1)
 		{
 			if (!eventProxy)
 			{
 				eventProxy = new EventProxy(this);
 			}

-			var actualType:String = EventUtil.sandboxRootMouseEventMap[type];
+			var actualType:String = EventUtil.sandboxMouseEventMap[type];
 			if (actualType)
 			{
 				if (isTopLevelRoot())
 				{
 					stage.addEventListener(MouseEvent.MOUSE_MOVE, resetMouseCursorTracking, true, EventPriority.CURSOR_MANAGEMENT + 1, true);
-					addEventListenerToSandboxes(SandboxRootMouseEvent.MOUSE_MOVE_SOMEWHERE, resetMouseCursorTracking, true, EventPriority.CURSOR_MANAGEMENT + 1, true);
+					addEventListenerToSandboxes(SandboxMouseEvent.MOUSE_MOVE_SOMEWHERE, resetMouseCursorTracking, true, EventPriority.CURSOR_MANAGEMENT + 1, true);
 				}
 				else
 				{
@@ -1422,6 +1418,11 @@
 				}

 				addEventListenerToSandboxes(type, sandboxMouseListener, useCapture, priority, useWeakReference);
+				if (!SystemManagerGlobals.changingListenersInOtherSystemManagers)
+					addEventListenerToOtherSystemManagers(type, otherSystemManagerMouseListener, useCapture, priority, useWeakReference)
+				if (getSandboxRoot() == this)
+                    super.addEventListener(actualType, eventProxy.marshalListener,
+                            useCapture, priority, useWeakReference);

 				// Set useCapture to false because we will never see an event
 				// marshalled in the capture phase.
@@ -1518,9 +1519,14 @@

 		if (hasSWFBridges())
 		{
-			var actualType:String = EventUtil.sandboxRootMouseEventMap[type];
+			var actualType:String = EventUtil.sandboxMouseEventMap[type];
 			if (actualType)
 			{
+				if (getSandboxRoot() == this)
+                    super.removeEventListener(actualType, eventProxy.marshalListener,
+                            useCapture);
+				if (!SystemManagerGlobals.changingListenersInOtherSystemManagers)
+					removeEventListenerFromOtherSystemManagers(type, otherSystemManagerMouseListener, useCapture);
 				removeEventListenerFromSandboxes(type, sandboxMouseListener, useCapture);
 				super.removeEventListener(type, listener, false);
 				return;
@@ -2853,29 +2859,29 @@

 			// send message to parent that we are ready.
 			// pass up the sandbox bridge to the parent so its knows who we are.
-			var bridgeEvent:SWFBridgeEvent = new SWFBridgeEvent(SWFBridgeEvent.NOTIFY_NEW_BRIDGED_APPLICATION);
+			var bridgeEvent:SWFBridgeEvent = new SWFBridgeEvent(SWFBridgeEvent.BRIDGE_NEW_APPLICATION);
 			bridgeEvent.data = swfBridgeGroup.parentBridge;

 			swfBridgeGroup.parentBridge.dispatchEvent(bridgeEvent);

 			// placeholder popups are started locally
-			addEventListener(PopUpRequest.ADD_POP_UP_PLACE_HOLDER_REQUEST, addPlaceholderPopupRequestHandler);
+			addEventListener(SWFBridgeRequest.ADD_POP_UP_PLACE_HOLDER_REQUEST, addPlaceholderPopupRequestHandler);

 			root.loaderInfo.addEventListener(Event.UNLOAD, unloadHandler, false, 0, true);
 		}

 		// every SM has to have this listener in case it is the SM for some child AD that contains a manager
 		// and the parent ADs don't have that manager.
-		getSandboxRoot().addEventListener(SandboxRootRequest.INIT_MANAGER_REQUEST, initManagerHandler, false, 0, true);
+		getSandboxRoot().addEventListener(InterManagerRequest.INIT_MANAGER_REQUEST, initManagerHandler, false, 0, true);
 		// once managers get initialized, they bounce things off the sandbox root
 		if (getSandboxRoot() == this)
 		{
-			addEventListener(SandboxRootRequest.SYSTEM_MANAGER_REQUEST, systemManagerHandler);
-
-			addEventListener(PopUpRequest.ADD_POP_UP_PLACE_HOLDER_REQUEST, addPlaceholderPopupRequestHandler);
-			addEventListener(PopUpRequest.REMOVE_POP_UP_PLACE_HOLDER_REQUEST, removePlaceholderPopupRequestHandler);
-			addEventListener(SWFBridgeEvent.NOTIFY_WINDOW_ACTIVATED, activateFormSandboxEventHandler);
-			addEventListener(SWFBridgeEvent.NOTIFY_WINDOW_DEACTIVATED, deactivateFormSandboxEventHandler);
+			addEventListener(InterManagerRequest.SYSTEM_MANAGER_REQUEST, systemManagerHandler);
+
+			addEventListener(SWFBridgeRequest.ADD_POP_UP_PLACE_HOLDER_REQUEST, addPlaceholderPopupRequestHandler);
+			addEventListener(SWFBridgeRequest.REMOVE_POP_UP_PLACE_HOLDER_REQUEST, removePlaceholderPopupRequestHandler);
+			addEventListener(SWFBridgeEvent.BRIDGE_WINDOW_ACTIVATE, activateFormSandboxEventHandler);
+			addEventListener(SWFBridgeEvent.BRIDGE_WINDOW_DEACTIVATE, deactivateFormSandboxEventHandler);
 			addEventListener(SWFBridgeRequest.HIDE_MOUSE_CURSOR_REQUEST, hideMouseCursorRequestHandler);
 			addEventListener(SWFBridgeRequest.SHOW_MOUSE_CURSOR_REQUEST, showMouseCursorRequestHandler);
 			addEventListener(SWFBridgeRequest.RESET_MOUSE_CURSOR_REQUEST, resetMouseCursorRequestHandler);
@@ -3549,10 +3555,10 @@
 	 */
 	private function addPopupRequestHandler(event:Event):void
 	{
-		if (event.target != this && event is PopUpRequest)
+		if (event.target != this && event is SWFBridgeRequest)
 			return;

-		var popUpRequest:PopUpRequest = PopUpRequest.marshal(event);
+		var popUpRequest:SWFBridgeRequest = SWFBridgeRequest.marshal(event);

 		// If there is not for mutual trust between us an the child that wants the
 		// popup, then don't host the pop up.
@@ -3576,30 +3582,30 @@
 		}

 		// add popup as a child of this system manager
-        if (!popUpRequest.childList || popUpRequest.childList == PopUpManagerChildList.PARENT)
-            topMost = popUpRequest.parent && popUpChildren.contains(popUpRequest.parent);
+        if (!popUpRequest.data.childList || popUpRequest.data.childList == PopUpManagerChildList.PARENT)
+            topMost = popUpRequest.data.parent && popUpChildren.contains(popUpRequest.data.parent);
         else
-            topMost = (popUpRequest.childList == PopUpManagerChildList.POPUP);
+            topMost = (popUpRequest.data.childList == PopUpManagerChildList.POPUP);

         var children:IChildList;
         children = topMost ? popUpChildren : this;
-        children.addChild(DisplayObject(popUpRequest.window));
+        children.addChild(DisplayObject(popUpRequest.data.window));

-        if (popUpRequest.modal)
+        if (popUpRequest.data.modal)
 	        numModalWindows++;

 		// add popup to the list of managed forms
-		var remoteForm:RemotePopUp = new RemotePopUp(popUpRequest.window, popUpRequest.requestor);
+		var remoteForm:RemotePopUp = new RemotePopUp(popUpRequest.data.window, popUpRequest.requestor);
 		forms.push(remoteForm);

 		if (!isTopLevelRoot() && swfBridgeGroup)
 		{
 			// We've added the popup as far as it can go.
 			// Add a placeholder to the top level root application
-			var request:PopUpRequest = new PopUpRequest(PopUpRequest.ADD_POP_UP_PLACE_HOLDER_REQUEST, false, false,
-			                                            popUpRequest.window);
+			var request:SWFBridgeRequest = new SWFBridgeRequest(SWFBridgeRequest.ADD_POP_UP_PLACE_HOLDER_REQUEST, false, false, null,
+														{ window: popUpRequest.data.window });
 			request.requestor = popUpRequest.requestor;
-			request.placeHolderId = NameUtil.displayObjectToString(DisplayObject(popUpRequest.window));
+			request.data.placeHolderId = NameUtil.displayObjectToString(DisplayObject(popUpRequest.data.window));
 			dispatchEvent(request);
 		}
 	}
@@ -3613,7 +3619,7 @@
 	 */
 	private function removePopupRequestHandler(event:Event):void
 	{
-		var popUpRequest:PopUpRequest = PopUpRequest.marshal(event);
+		var popUpRequest:SWFBridgeRequest = SWFBridgeRequest.marshal(event);

 		if (swfBridgeGroup.parentBridge &&
 		    SecurityUtil.hasMutualTrustBetweenParentAndChild(this))
@@ -3623,23 +3629,23 @@
 			return;
 		}

-        if (popUpChildren.contains(popUpRequest.window))
-            popUpChildren.removeChild(popUpRequest.window);
+        if (popUpChildren.contains(popUpRequest.data.window))
+            popUpChildren.removeChild(popUpRequest.data.window);
         else
-            removeChild(DisplayObject(popUpRequest.window));
+            removeChild(DisplayObject(popUpRequest.data.window));

-        if (popUpRequest.modal)
+        if (popUpRequest.data.modal)
 			numModalWindows--;

-		removeRemotePopUp(new RemotePopUp(popUpRequest.window, popUpRequest.requestor));
+		removeRemotePopUp(new RemotePopUp(popUpRequest.data.window, popUpRequest.requestor));

 		if (!isTopLevelRoot() && swfBridgeGroup)
 		{
 			// if we got here we know the parent is untrusted, so remove placeholders
-			var request:PopUpRequest = new PopUpRequest(PopUpRequest.REMOVE_POP_UP_PLACE_HOLDER_REQUEST, false, false,
+			var request:SWFBridgeRequest = new SWFBridgeRequest(SWFBridgeRequest.REMOVE_POP_UP_PLACE_HOLDER_REQUEST, false, false,
 														null);
 			request.requestor = swfBridgeGroup.parentBridge;
-			request.placeHolderId = NameUtil.displayObjectToString(popUpRequest.window);
+			request.data.placeHolderId = NameUtil.displayObjectToString(popUpRequest.data.window);
 			dispatchEvent(request);
 		}

@@ -3654,15 +3660,15 @@
 	 */
 	 private function addPlaceholderPopupRequestHandler(event:Event):void
 	 {
-		var popUpRequest:PopUpRequest = PopUpRequest.marshal(event);
-
-		if (event.target != this && event is PopUpRequest)
+		var popUpRequest:SWFBridgeRequest = SWFBridgeRequest.marshal(event);
+
+		if (event.target != this && event is SWFBridgeRequest)
 			return;

 		if (!forwardPlaceholderRequest(popUpRequest, true))
 		{
 			// Create a RemotePopUp and add it.
-			var remoteForm:RemotePopUp = new RemotePopUp(popUpRequest.placeHolderId, popUpRequest.requestor);
+			var remoteForm:RemotePopUp = new RemotePopUp(popUpRequest.data.placeHolderId, popUpRequest.requestor);
 			forms.push(remoteForm);
 		}

@@ -3677,7 +3683,7 @@
 	 */
 	 private function removePlaceholderPopupRequestHandler(event:Event):void
 	 {
-		var popUpRequest:PopUpRequest = PopUpRequest.marshal(event);
+		var popUpRequest:SWFBridgeRequest = SWFBridgeRequest.marshal(event);

 		if (!forwardPlaceholderRequest(popUpRequest, false))
 		{
@@ -3687,7 +3693,7 @@
 			{
 				if (isRemotePopUp(forms[i]))
 				{
-					if (forms[i].window == popUpRequest.placeHolderId &&
+					if (forms[i].window == popUpRequest.data.placeHolderId &&
 					    forms[i].bridge == popUpRequest.requestor)
 					{
 						forms.splice(i, 1);
@@ -3714,7 +3720,6 @@
 		if (bridge)
 		{
 			var sbRoot:DisplayObject = getSandboxRoot();
-			eObj.sender =  bridge;
 			if (sbRoot == this)
 			{
 				if (!(eObj.data is String))
@@ -3755,26 +3760,26 @@
 		// stop on the way up the parent chain.
 		var refObj:Object = null;
 		var oldId:String = null;
-		if (eObj.window)
-		{
-			refObj = eObj.window;
+		if (eObj.data.window)
+		{
+			refObj = eObj.data.window;

 			// null this ref out so untrusted parent cannot see
-			eObj.window = null;
+			eObj.data.window = null;
 		}
 		else
 		{
 			refObj = eObj.requestor;

 			// prefix the existing id with the id of this object
-			oldId = eObj.placeHolderId;
-			eObj.placeHolderId = NameUtil.displayObjectToString(this) + "." + eObj.placeHolderId;
+			oldId = eObj.data.placeHolderId;
+			eObj.data.placeHolderId = NameUtil.displayObjectToString(this) + "." + eObj.data.placeHolderId;
 		}

 		if (addPlaceholder)
-			addPlaceholderId(eObj.placeHolderId, oldId, eObj.requestor, refObj);
+			addPlaceholderId(eObj.data.placeHolderId, oldId, eObj.requestor, refObj);
 		else
-			removePlaceholderId(eObj.placeHolderId);
+			removePlaceholderId(eObj.data.placeHolderId);

 		var sbRoot:DisplayObject = getSandboxRoot();
@@ -3807,7 +3812,7 @@
 			// deactivate the form
 			if (isRemotePopUp(form) &&
 				RemotePopUp(form).window == eObj.data &&
-				RemotePopUp(form).bridge == eObj.sender)
+				RemotePopUp(form).bridge == eObj.target)
 				deactivateForm(form);
 		}
 	}
@@ -3826,7 +3831,7 @@

 		if (!forwardFormEvent(eObj))
 			// just call activate on the remote form.
-			activateForm(new RemotePopUp(eObj.data, eObj.sender));
+			activateForm(new RemotePopUp(eObj.data, eObj.target));
 	}

 	/**
@@ -3857,10 +3862,10 @@
      */
     private function modalWindowRequestHandler(event:Event):void
     {
-        if (event is ModalWindowRequest)
+        if (event is SWFBridgeRequest)
             return;

-        var request:ModalWindowRequest = ModalWindowRequest.marshal(event);
+        var request:SWFBridgeRequest = SWFBridgeRequest.marshal(event);

         if (!preProcessModalWindowRequest(request, this, getSandboxRoot()))
             return;
@@ -3934,7 +3939,7 @@
             bridge.dispatchEvent(request);
         }
 		else if (eventProxy)
-			showMouseCursor = false;
+			SystemManagerGlobals.showMouseCursor = false;
 	}

     /**
@@ -3959,7 +3964,7 @@
 	        Object(event).data = request.data;           // update request
         }
 		else if (eventProxy)
-	        Object(event).data = showMouseCursor;
+	        Object(event).data = SystemManagerGlobals.showMouseCursor;

     }

@@ -3984,19 +3989,17 @@
             bridge.dispatchEvent(request);
         }
 		else if (eventProxy)
-	        showMouseCursor = true;
+	        SystemManagerGlobals.showMouseCursor = true;

     }

-	private var showMouseCursor:Boolean = true;
-
 	private function resetMouseCursorTracking(event:Event):void
 	{
 		if (isTopLevelRoot())
 		{
-			showMouseCursor = true;
-		}
-		else
+			SystemManagerGlobals.showMouseCursor = true;
+		}
+		else if (swfBridgeGroup.parentBridge)
 		{
 			var cursorRequest:SWFBridgeRequest = new SWFBridgeRequest(SWFBridgeRequest.RESET_MOUSE_CURSOR_REQUEST);
 			var bridge:IEventDispatcher = swfBridgeGroup.parentBridge;
@@ -4020,7 +4023,7 @@
 	private function setActualSizeRequestHandler(event:Event):void
 	{
 		var eObj:Object = Object(event);
-		setActualSize(eObj.width, eObj.height);
+		setActualSize(eObj.data.width, eObj.data.height);
 	}

 	/**
@@ -4032,8 +4035,7 @@
 	private function getSizeRequestHandler(event:Event):void
 	{
 		var eObj:Object = Object(event);
-		eObj.width = measuredWidth;
-		eObj.height = measuredHeight;
+		eObj.data = { width: measuredWidth, height: measuredHeight};
 	}

 	/**
@@ -4155,8 +4157,7 @@
 	 * Is the child in event.data this system manager or a child of this
 	 * system manager?
 	 *
-	 * If the display object is a child event.preventDefault is called,
-	 * otherwise nothing is done.
+	 * Set the data property to indicate if the display object is a child
 	 */
 	private function isBridgeChildHandler(event:Event):void
 	{
@@ -4167,18 +4168,14 @@

 		var eObj:Object = Object(event);

-		if (eObj.data && rawChildren.contains(eObj.data as DisplayObject))
-		{
-			event.preventDefault();
-		}
+		eObj.data = eObj.data && rawChildren.contains(eObj.data as DisplayObject);
 	}

 	/**
 	 * Can this form be activated. The current test is if the given pop up
 	 * is visible and is enabled.
 	 *
-	 * If the can be activated event.preventDefault is called,
-	 * otherwise nothing is done.
+	 * Set the data proeprty to indicate if can be activated
 	 */
 	private function canActivateHandler(event:Event):void
 	{
@@ -4211,7 +4208,7 @@
 				 	if (popUp.bridge)
 				 	{
 				 		popUp.bridge.dispatchEvent(request);
-				 		request.data = true;
+				 		eObj.data = true;
 				 	}
 					return;
 				}
@@ -4222,13 +4219,11 @@
 		{
 			var smp:SystemManagerProxy = SystemManagerProxy(child);
 			var f:IFocusManagerContainer = findFocusManagerContainer(smp);
-			if (smp && f && canActivateLocalComponent(f))
-				event.preventDefault();
+			eObj.data = smp && f && canActivateLocalComponent(f);
 		}
 		else if (child is IFocusManagerContainer)
 		{
-			if (canActivateLocalComponent(child))
-				event.preventDefault();
+			eObj.data = canActivateLocalComponent(child);
 		}
 		else if (child is IEventDispatcher)
 		{
@@ -4241,7 +4236,7 @@
 			if (bridge)
 			{
 				bridge.dispatchEvent(request);
-				request.data = true;
+				eObj.data = true;
 			}
 		}
 		else
@@ -4273,7 +4268,7 @@
 				var bp:ISWFBridgeProvider = swfBridgeGroup.getChildBridgeProvider(childBridge);
 				childBridge.dispatchEvent(request);
 				if (SecurityUtil.hasMutualTrustBetweenParentAndChild(bp) &&
-					request.data == false)
+					request.data == true)
 					return true;
 			}
 		}
@@ -4288,12 +4283,18 @@
 	{
 		// if we are broadcasting messages, ignore the messages
 		// we send to ourselves.
-		if (event is SandboxRootRequest)
+		if (event is InterManagerRequest)
 			return;

 		// initialize the registered manager implementation
 		var name:String = event["name"];
-		Singleton.getInstance(name);
+		try
+		{
+			Singleton.getInstance(name);
+		}
+		catch (e:Error)
+		{
+		}
 	}

 	/**
@@ -4308,7 +4309,7 @@
 		else
 		{
 			addingChild(child);
-			var me:SandboxRootRequest = new SandboxRootRequest(SandboxRootRequest.SYSTEM_MANAGER_REQUEST);
+			var me:InterManagerRequest = new InterManagerRequest(InterManagerRequest.SYSTEM_MANAGER_REQUEST);
 			me.name = layer + ".addChild";
 			me.value = child;
 			getSandboxRoot().dispatchEvent(me);
@@ -4328,7 +4329,7 @@
 		else
 		{
 			removingChild(child);
-			var me:SandboxRootRequest = new SandboxRootRequest(SandboxRootRequest.SYSTEM_MANAGER_REQUEST);
+			var me:InterManagerRequest = new InterManagerRequest(InterManagerRequest.SYSTEM_MANAGER_REQUEST);
 			me.name = layer + ".removeChild";
 			me.value = child;
 			getSandboxRoot().dispatchEvent(me);
@@ -4350,7 +4351,7 @@

 		// if we are broadcasting messages, ignore the messages
 		// we send to ourselves.
-		if (event is SandboxRootRequest)
+		if (event is InterManagerRequest)
 			return;

 		// initialize the registered manager implementation
@@ -4442,7 +4443,7 @@
     	}
     	else
     	{
-	    	var me:SandboxRootRequest = new SandboxRootRequest(SandboxRootRequest.SYSTEM_MANAGER_REQUEST, false, false,
+	    	var me:InterManagerRequest = new InterManagerRequest(InterManagerRequest.SYSTEM_MANAGER_REQUEST, false, false,
     											   "screen");
     		sandboxRoot.dispatchEvent(me);

@@ -4496,18 +4497,18 @@
 			return;
 		}

-		bridge.addEventListener(PopUpRequest.ADD_POP_UP_REQUEST, addPopupRequestHandler);
-		bridge.addEventListener(PopUpRequest.REMOVE_POP_UP_REQUEST, removePopupRequestHandler);
-		bridge.addEventListener(PopUpRequest.ADD_POP_UP_PLACE_HOLDER_REQUEST, addPlaceholderPopupRequestHandler);
-		bridge.addEventListener(PopUpRequest.REMOVE_POP_UP_PLACE_HOLDER_REQUEST, removePlaceholderPopupRequestHandler);
-		bridge.addEventListener(SWFBridgeEvent.NOTIFY_WINDOW_ACTIVATED, activateFormSandboxEventHandler);
-		bridge.addEventListener(SWFBridgeEvent.NOTIFY_WINDOW_DEACTIVATED, deactivateFormSandboxEventHandler);
-		bridge.addEventListener(SWFBridgeEvent.NOTIFY_APPLICATION_ACTIVATED, activateApplicationSandboxEventHandler);
+		bridge.addEventListener(SWFBridgeRequest.ADD_POP_UP_REQUEST, addPopupRequestHandler);
+		bridge.addEventListener(SWFBridgeRequest.REMOVE_POP_UP_REQUEST, removePopupRequestHandler);
+		bridge.addEventListener(SWFBridgeRequest.ADD_POP_UP_PLACE_HOLDER_REQUEST, addPlaceholderPopupRequestHandler);
+		bridge.addEventListener(SWFBridgeRequest.REMOVE_POP_UP_PLACE_HOLDER_REQUEST, removePlaceholderPopupRequestHandler);
+		bridge.addEventListener(SWFBridgeEvent.BRIDGE_WINDOW_ACTIVATE, activateFormSandboxEventHandler);
+		bridge.addEventListener(SWFBridgeEvent.BRIDGE_WINDOW_DEACTIVATE, deactivateFormSandboxEventHandler);
+		bridge.addEventListener(SWFBridgeEvent.BRIDGE_APPLICATION_ACTIVATE, activateApplicationSandboxEventHandler);
 		bridge.addEventListener(EventListenerRequest.ADD_EVENT_LISTENER_REQUEST, eventListenerRequestHandler, false, 0, true);
 		bridge.addEventListener(EventListenerRequest.REMOVE_EVENT_LISTENER_REQUEST, eventListenerRequestHandler, false, 0, true);
-        bridge.addEventListener(ModalWindowRequest.CREATE_MODAL_WINDOW_REQUEST, modalWindowRequestHandler);
-        bridge.addEventListener(ModalWindowRequest.SHOW_MODAL_WINDOW_REQUEST, modalWindowRequestHandler);
-        bridge.addEventListener(ModalWindowRequest.HIDE_MODAL_WINDOW_REQUEST, modalWindowRequestHandler);
+        bridge.addEventListener(SWFBridgeRequest.CREATE_MODAL_WINDOW_REQUEST, modalWindowRequestHandler);
+        bridge.addEventListener(SWFBridgeRequest.SHOW_MODAL_WINDOW_REQUEST, modalWindowRequestHandler);
+        bridge.addEventListener(SWFBridgeRequest.HIDE_MODAL_WINDOW_REQUEST, modalWindowRequestHandler);
         bridge.addEventListener(SWFBridgeRequest.GET_VISIBLE_RECT_REQUEST, getVisibleRectRequestHandler);
         bridge.addEventListener(SWFBridgeRequest.HIDE_MOUSE_CURSOR_REQUEST, hideMouseCursorRequestHandler);
         bridge.addEventListener(SWFBridgeRequest.SHOW_MOUSE_CURSOR_REQUEST, showMouseCursorRequestHandler);
@@ -4527,18 +4528,18 @@
 			return;
 		}

-		bridge.removeEventListener(PopUpRequest.ADD_POP_UP_REQUEST, addPopupRequestHandler);
-		bridge.removeEventListener(PopUpRequest.REMOVE_POP_UP_REQUEST, removePopupRequestHandler);
-		bridge.removeEventListener(PopUpRequest.ADD_POP_UP_PLACE_HOLDER_REQUEST, addPlaceholderPopupRequestHandler);
-		bridge.removeEventListener(PopUpRequest.REMOVE_POP_UP_PLACE_HOLDER_REQUEST, removePlaceholderPopupRequestHandler);
-		bridge.removeEventListener(SWFBridgeEvent.NOTIFY_WINDOW_ACTIVATED, activateFormSandboxEventHandler);
-		bridge.removeEventListener(SWFBridgeEvent.NOTIFY_WINDOW_DEACTIVATED, deactivateFormSandboxEventHandler);
-		bridge.removeEventListener(SWFBridgeEvent.NOTIFY_APPLICATION_ACTIVATED, activateApplicationSandboxEventHandler);
+		bridge.removeEventListener(SWFBridgeRequest.ADD_POP_UP_REQUEST, addPopupRequestHandler);
+		bridge.removeEventListener(SWFBridgeRequest.REMOVE_POP_UP_REQUEST, removePopupRequestHandler);
+		bridge.removeEventListener(SWFBridgeRequest.ADD_POP_UP_PLACE_HOLDER_REQUEST, addPlaceholderPopupRequestHandler);
+		bridge.removeEventListener(SWFBridgeRequest.REMOVE_POP_UP_PLACE_HOLDER_REQUEST, removePlaceholderPopupRequestHandler);
+		bridge.removeEventListener(SWFBridgeEvent.BRIDGE_WINDOW_ACTIVATE, activateFormSandboxEventHandler);
+		bridge.removeEventListener(SWFBridgeEvent.BRIDGE_WINDOW_DEACTIVATE, deactivateFormSandboxEventHandler);
+		bridge.removeEventListener(SWFBridgeEvent.BRIDGE_APPLICATION_ACTIVATE, activateApplicationSandboxEventHandler);
 		bridge.removeEventListener(EventListenerRequest.ADD_EVENT_LISTENER_REQUEST, eventListenerRequestHandler);
 		bridge.removeEventListener(EventListenerRequest.REMOVE_EVENT_LISTENER_REQUEST, eventListenerRequestHandler);
-        bridge.removeEventListener(ModalWindowRequest.CREATE_MODAL_WINDOW_REQUEST, modalWindowRequestHandler);
-        bridge.removeEventListener(ModalWindowRequest.SHOW_MODAL_WINDOW_REQUEST, modalWindowRequestHandler);
-        bridge.removeEventListener(ModalWindowRequest.HIDE_MODAL_WINDOW_REQUEST, modalWindowRequestHandler);
+        bridge.removeEventListener(SWFBridgeRequest.CREATE_MODAL_WINDOW_REQUEST, modalWindowRequestHandler);
+        bridge.removeEventListener(SWFBridgeRequest.SHOW_MODAL_WINDOW_REQUEST, modalWindowRequestHandler);
+        bridge.removeEventListener(SWFBridgeRequest.HIDE_MODAL_WINDOW_REQUEST, modalWindowRequestHandler);
         bridge.removeEventListener(SWFBridgeRequest.GET_VISIBLE_RECT_REQUEST, getVisibleRectRequestHandler);
         bridge.removeEventListener(SWFBridgeRequest.HIDE_MOUSE_CURSOR_REQUEST, hideMouseCursorRequestHandler);
         bridge.removeEventListener(SWFBridgeRequest.SHOW_MOUSE_CURSOR_REQUEST, showMouseCursorRequestHandler);
@@ -4560,8 +4561,8 @@
 		}

 		var bridge:IEventDispatcher = swfBridgeGroup.parentBridge;
-		bridge.addEventListener(SizeRequest.SET_ACTUAL_SIZE_REQUEST, setActualSizeRequestHandler);
-		bridge.addEventListener(SizeRequest.GET_SIZE_REQUEST, getSizeRequestHandler);
+		bridge.addEventListener(SWFBridgeRequest.SET_ACTUAL_SIZE_REQUEST, setActualSizeRequestHandler);
+		bridge.addEventListener(SWFBridgeRequest.GET_SIZE_REQUEST, getSizeRequestHandler);

 		// need to listener to parent system manager to get broadcast messages.
 		bridge.addEventListener(SWFBridgeRequest.ACTIVATE_POP_UP_REQUEST,
@@ -4572,7 +4573,7 @@
 		bridge.addEventListener(EventListenerRequest.ADD_EVENT_LISTENER_REQUEST, eventListenerRequestHandler);
 		bridge.addEventListener(EventListenerRequest.REMOVE_EVENT_LISTENER_REQUEST, eventListenerRequestHandler);
 		bridge.addEventListener(SWFBridgeRequest.CAN_ACTIVATE_POP_UP_REQUEST, canActivateHandler);
-		bridge.addEventListener(SWFBridgeEvent.NOTIFY_BEFORE_UNLOAD, beforeUnloadHandler);
+		bridge.addEventListener(SWFBridgeEvent.BRIDGE_APPLICATION_UNLOADING, beforeUnloadHandler);
 	}

 	/**
@@ -4590,8 +4591,8 @@
 		}

 		var bridge:IEventDispatcher = swfBridgeGroup.parentBridge;
-		bridge.removeEventListener(SizeRequest.SET_ACTUAL_SIZE_REQUEST, setActualSizeRequestHandler);
-		bridge.removeEventListener(SizeRequest.GET_SIZE_REQUEST, getSizeRequestHandler);
+		bridge.removeEventListener(SWFBridgeRequest.SET_ACTUAL_SIZE_REQUEST, setActualSizeRequestHandler);
+		bridge.removeEventListener(SWFBridgeRequest.GET_SIZE_REQUEST, getSizeRequestHandler);

 		// need to listener to parent system manager to get broadcast messages.
 		bridge.removeEventListener(SWFBridgeRequest.ACTIVATE_POP_UP_REQUEST,
@@ -4602,7 +4603,7 @@
 		bridge.removeEventListener(EventListenerRequest.ADD_EVENT_LISTENER_REQUEST, eventListenerRequestHandler);
 		bridge.removeEventListener(EventListenerRequest.REMOVE_EVENT_LISTENER_REQUEST, eventListenerRequestHandler);
 		bridge.removeEventListener(SWFBridgeRequest.CAN_ACTIVATE_POP_UP_REQUEST, canActivateHandler);
-		bridge.removeEventListener(SWFBridgeEvent.NOTIFY_BEFORE_UNLOAD, beforeUnloadHandler);
+		bridge.removeEventListener(SWFBridgeEvent.BRIDGE_APPLICATION_UNLOADING, beforeUnloadHandler);
 	}

 	private function getTopLevelSystemManager(parent:DisplayObject):ISystemManager
@@ -4625,12 +4626,6 @@
 		return sm;
 	}

-	private function isNotContentIFlexDisplayObjectHandler(event:Event):void
-	{
-		event.preventDefault();		// returns false which means we are a IFlexDisplayObject
-		return;
-	}
-
 	/**
 	 * Override parent property to handle the case where the parent is in
 	 * a differnt sandbox. If the parent is in the same sandbox it is returned.
@@ -4850,7 +4845,7 @@
     */
     public function deployMouseShields(deploy:Boolean):void
     {
-        var me:SandboxRootRequest = new SandboxRootRequest(SandboxRootRequest.DRAG_MANAGER_REQUEST, false, false,
+        var me:InterManagerRequest = new InterManagerRequest(InterManagerRequest.DRAG_MANAGER_REQUEST, false, false,
                                     "mouseShield", deploy);
         getSandboxRoot().dispatchEvent(me);
     }
@@ -4869,7 +4864,7 @@
 		{
 			var sbRoot:DisplayObject = getSandboxRoot();
 			var sendToSbRoot:Boolean = sbRoot != this;
-			var bridgeEvent:SWFBridgeEvent = new SWFBridgeEvent(SWFBridgeEvent.NOTIFY_WINDOW_ACTIVATED,
+			var bridgeEvent:SWFBridgeEvent = new SWFBridgeEvent(SWFBridgeEvent.BRIDGE_WINDOW_ACTIVATE,
 																	    false, false,
 	       																sendToSbRoot ? window :
 	       																NameUtil.displayObjectToString(window));
@@ -4896,7 +4891,7 @@
 		{
 			var sbRoot:DisplayObject = getSandboxRoot();
 			var sendToSbRoot:Boolean = sbRoot != this;
-			var bridgeEvent:SWFBridgeEvent = new SWFBridgeEvent(SWFBridgeEvent.NOTIFY_WINDOW_DEACTIVATED,
+			var bridgeEvent:SWFBridgeEvent = new SWFBridgeEvent(SWFBridgeEvent.BRIDGE_WINDOW_DEACTIVATE,
 																	    false,
 																	    false,
 	       																sendToSbRoot ? window :
@@ -4922,7 +4917,7 @@
 		var bridge:IEventDispatcher = swfBridgeGroup ? swfBridgeGroup.parentBridge : null;
 		if (bridge)
 		{
-			var bridgeEvent:SWFBridgeEvent = new SWFBridgeEvent(SWFBridgeEvent.NOTIFY_APPLICATION_ACTIVATED,
+			var bridgeEvent:SWFBridgeEvent = new SWFBridgeEvent(SWFBridgeEvent.BRIDGE_APPLICATION_ACTIVATE,
 																		false, false,
 																		bridge);
 			bridge.dispatchEvent(bridgeEvent);
@@ -4988,11 +4983,32 @@

 	private var currentSandboxEvent:Event;

+	private var dispatchingToSystemManagers:Boolean = false;
+
 	/**
 	 * dispatch the event to all sandboxes except the specified one
 	 */
-	public function dispatchEventFromSWFBridges(event:Event, skip:IEventDispatcher = null, trackClones:Boolean = false):void
-	{
+	public function dispatchEventFromSWFBridges(event:Event, skip:IEventDispatcher = null,
+						trackClones:Boolean = false, toOtherSystemManagers:Boolean = false):void
+	{
+		if (toOtherSystemManagers)
+		{
+			dispatchingToSystemManagers = true;
+			var arr:Array = SystemManagerGlobals.topLevelSystemManagers;
+			var n:int = arr.length;
+			for (var i:int = 0; i < n; i++)
+			{
+				if (arr[i] != this)
+				{
+					arr[i].dispatchEvent(event);
+				}
+			}
+			dispatchingToSystemManagers = false;
+		}
+
+		if (!swfBridgeGroup)
+			return;
+
 		var clone:Event;
 		// trace(">>dispatchEventFromSWFBridges", this, event.type);
 		clone = event.clone();
@@ -5005,7 +5021,7 @@
 		}

 		var children:Array = swfBridgeGroup.getChildBridges();
-		for (var i:int = 0; i < children.length; i++)
+		for (i = 0; i < children.length; i++)
 		{
 			if (children[i] != skip)
 			{
@@ -5027,6 +5043,9 @@
 	private function addEventListenerToSandboxes(type:String, listener:Function, useCapture:Boolean = false,
 				priority:int=0, useWeakReference:Boolean=false, skip:IEventDispatcher = null):void
 	{
+		if (!swfBridgeGroup)
+			return;
+
 		// trace(">>addEventListenerToSandboxes", this, type);

 		var request:EventListenerRequest = new EventListenerRequest(EventListenerRequest.ADD_EVENT_LISTENER_REQUEST, false, false,
@@ -5036,16 +5055,16 @@
 													useWeakReference);

 		var parentBridge:IEventDispatcher = swfBridgeGroup.parentBridge;
-		if (parentBridge)
-		{
+		if (parentBridge && parentBridge != skip)
 			parentBridge.addEventListener(type, listener, false, priority, useWeakReference);
-		}

 		var children:Array = swfBridgeGroup.getChildBridges();
 		for (var i:int; i < children.length; i++)
 		{
 		 	var childBridge:IEventDispatcher = IEventDispatcher(children[i]);
-			childBridge.addEventListener(type, listener, false, priority, useWeakReference);
+
+		 	if (childBridge != skip)
+    		    childBridge.addEventListener(type, listener, false, priority, useWeakReference);
 		}

 		dispatchEventFromSWFBridges(request, skip);
@@ -5059,22 +5078,70 @@
 	                                                  useCapture:Boolean = false,
 	                                                  skip:IEventDispatcher = null):void
 	{
+		if (!swfBridgeGroup)
+			return;
+
 		// trace(">>removeEventListenerToSandboxes", this, type);
 		var request:EventListenerRequest = new EventListenerRequest(EventListenerRequest.REMOVE_EVENT_LISTENER_REQUEST, false, false,
 																				type,
 																				useCapture);
 		var parentBridge:IEventDispatcher = swfBridgeGroup.parentBridge;
-		if (parentBridge)
+		if (parentBridge && parentBridge != skip)
 			parentBridge.removeEventListener(type, listener, useCapture);

 		var children:Array = swfBridgeGroup.getChildBridges();
 		for (var i:int; i < children.length; i++)
 		{
-			IEventDispatcher(children[i]).removeEventListener(type, listener, useCapture);
+		    if (children[i] != skip)
+		        IEventDispatcher(children[i]).removeEventListener(type, listener, useCapture);
 		}

 		dispatchEventFromSWFBridges(request, skip);
 		// trace("<<removeEventListenerToSandboxes", this, type);
+	}
+
+	/**
+	 * request the parent to add an event listener.
+	 */
+	private function addEventListenerToOtherSystemManagers(type:String, listener:Function, useCapture:Boolean = false,
+				priority:int=0, useWeakReference:Boolean=false):void
+	{
+		var arr:Array = SystemManagerGlobals.topLevelSystemManagers;
+		if (arr.length < 2)
+			return;
+
+		SystemManagerGlobals.changingListenersInOtherSystemManagers = true;
+		var n:int = arr.length;
+		for (var i:int = 0; i < n; i++)
+		{
+			if (arr[i] != this)
+			{
+				arr[i].addEventListener(type, listener, useCapture, priority, useWeakReference);
+			}
+		}
+		SystemManagerGlobals.changingListenersInOtherSystemManagers = false;
+	}
+
+	/**
+	 * request the parent to remove an event listener.
+	 */
+	private function removeEventListenerFromOtherSystemManagers(type:String, listener:Function,
+	                                                  useCapture:Boolean = false):void
+	{
+		var arr:Array = SystemManagerGlobals.topLevelSystemManagers;
+		if (arr.length < 2)
+			return;
+
+		SystemManagerGlobals.changingListenersInOtherSystemManagers = true;
+		var n:int = arr.length;
+		for (var i:int = 0; i < n; i++)
+		{
+			if (arr[i] != this)
+			{
+				arr[i].removeEventListener(type, listener, useCapture);
+			}
+		}
+		SystemManagerGlobals.changingListenersInOtherSystemManagers = false;
 	}

     /**
@@ -5083,16 +5150,16 @@
      *   @return true if the message should be processed, false if
      *   no other action is required.
      */
-    private function preProcessModalWindowRequest(request:ModalWindowRequest,
+    private function preProcessModalWindowRequest(request:SWFBridgeRequest,
                                                   sm:ISystemManager,
                                                   sbRoot:DisplayObject):Boolean
     {
         // should we process this message?
-        if (request.skip)
+        if (request.data.skip)
         {
             // skipping this sandbox,
             // but don't skip the next one.
-            request.skip = false;
+            request.data.skip = false;

             if (sm.useSWFBridge())
             {
@@ -5109,16 +5176,16 @@
             var forwardRequest:Boolean = false;

             // convert exclude component into a rectangle and forward to parent bridge.
-            if (request.type == ModalWindowRequest.CREATE_MODAL_WINDOW_REQUEST ||
-                request.type == ModalWindowRequest.SHOW_MODAL_WINDOW_REQUEST)
+            if (request.type == SWFBridgeRequest.CREATE_MODAL_WINDOW_REQUEST ||
+                request.type == SWFBridgeRequest.SHOW_MODAL_WINDOW_REQUEST)
             {
                 var exclude:ISWFLoader = sm.swfBridgeGroup.getChildBridgeProvider(request.requestor)
                                                  as ISWFLoader;
                 var excludeRect:Rectangle = ISWFLoader(exclude).getVisibleApplicationRect();
-                request.data = excludeRect;
+                request.data.excludeRect = excludeRect;
                 forwardRequest = true;
             }
-            else if (request.type == ModalWindowRequest.HIDE_MODAL_WINDOW_REQUEST)
+            else if (request.type == SWFBridgeRequest.HIDE_MODAL_WINDOW_REQUEST)
                 forwardRequest = true;

             if (forwardRequest)
@@ -5128,7 +5195,7 @@

                 // The HIDE request does not need to be processed by each
                 // application, so dispatch it directly to the sandbox root.
-                if (request.type == ModalWindowRequest.HIDE_MODAL_WINDOW_REQUEST)
+                if (request.type == SWFBridgeRequest.HIDE_MODAL_WINDOW_REQUEST)
                     sbRoot.dispatchEvent(request);
                 else
                     bridge.dispatchEvent(request);
@@ -5137,30 +5204,49 @@
         }

         // skip aftering sending the message over a bridge.
-        request.skip = false;
+        request.data.skip = false;

         return true;
     }

-	private function sandboxMouseListener(event:Event):void
-	{
-		// trace("sandboxMouseListener", this);
-		if (event is SandboxRootMouseEvent)
+	private function otherSystemManagerMouseListener(event:SandboxMouseEvent):void
+	{
+		if (dispatchingToSystemManagers)
 			return;

-		var marshaledEvent:Event = SandboxRootMouseEvent.marshal(event);
-		dispatchEventFromSWFBridges(marshaledEvent, event.target as IEventDispatcher);
+		dispatchEventFromSWFBridges(event);

 		// ask the sandbox root if it was the original dispatcher of this event
 		// if it was then don't dispatch to ourselves because we could have
 		// got this event by listening to sandboxRoot ourselves.
-		var me:SandboxRootRequest = new SandboxRootRequest(SandboxRootRequest.SYSTEM_MANAGER_REQUEST);
+		var me:InterManagerRequest = new InterManagerRequest(InterManagerRequest.SYSTEM_MANAGER_REQUEST);
 		me.name = "sameSandbox";
 		me.value = event;
 		getSandboxRoot().dispatchEvent(me);

 		if (!me.value)
+			dispatchEvent(event);
+	}
+
+	private function sandboxMouseListener(event:Event):void
+	{
+		// trace("sandboxMouseListener", this);
+		if (event is SandboxMouseEvent)
+			return;
+
+		var marshaledEvent:Event = SandboxMouseEvent.marshal(event);
+		dispatchEventFromSWFBridges(marshaledEvent, event.target as IEventDispatcher);
+
+		// ask the sandbox root if it was the original dispatcher of this event
+		// if it was then don't dispatch to ourselves because we could have
+		// got this event by listening to sandboxRoot ourselves.
+		var me:InterManagerRequest = new InterManagerRequest(InterManagerRequest.SYSTEM_MANAGER_REQUEST);
+		me.name = "sameSandbox";
+		me.value = event;
+		getSandboxRoot().dispatchEvent(me);
+
+		if (!me.value)
 			dispatchEvent(marshaledEvent);
 	}

@@ -5170,7 +5256,7 @@
 			return;

         var actualType:String;
-		var eventObj:Object = event;
+		var request:EventListenerRequest = EventListenerRequest.marshal(event);
 		if (event.type == EventListenerRequest.ADD_EVENT_LISTENER_REQUEST)
 		{
 			if (!eventProxy)
@@ -5178,32 +5264,39 @@
 				eventProxy = new EventProxy(this);
 			}

-			// trace(">>eventListenerRequestHandler ADD ", this, eventObj.userType);
-
-			actualType = EventUtil.sandboxRootMouseEventMap[eventObj.userType];
+			actualType = EventUtil.sandboxMouseEventMap[request.eventType];
 			if (actualType)
 			{
-				addEventListenerToSandboxes(eventObj.userType, sandboxMouseListener,
-							eventObj.useCapture, eventObj.priority, eventObj.useWeakReference, event.target as IEventDispatcher);
+				if (isTopLevelRoot())
+				{
+					stage.addEventListener(MouseEvent.MOUSE_MOVE, resetMouseCursorTracking, true, EventPriority.CURSOR_MANAGEMENT + 1, true);
+				}
+				else
+				{
+					super.addEventListener(MouseEvent.MOUSE_MOVE, resetMouseCursorTracking, true, EventPriority.CURSOR_MANAGEMENT + 1, true);
+				}
+
+				addEventListenerToSandboxes(request.eventType, sandboxMouseListener,
+							request.useCapture, request.priority, request.useWeakReference, event.target as IEventDispatcher);
+				addEventListenerToOtherSystemManagers(request.eventType, otherSystemManagerMouseListener,
+							request.useCapture, request.priority, request.useWeakReference);
 				if (getSandboxRoot() == this)
                     super.addEventListener(actualType, eventProxy.marshalListener,
-                            eventObj.useCapture, eventObj.priority, eventObj.useWeakReference);
-			}
-			// trace("<<eventListenerRequestHandler ADD ", this, eventObj.userType);
+                            request.useCapture, request.priority, request.useWeakReference);
+			}
 		}
 		else if (event.type == EventListenerRequest.REMOVE_EVENT_LISTENER_REQUEST)
         {
-            // trace(">>eventListenerRequestHandler REMOVE ", this, eventObj.userType);
-            actualType = EventUtil.sandboxRootMouseEventMap[eventObj.userType];
+            actualType = EventUtil.sandboxMouseEventMap[request.eventType];
             if (actualType)
             {
-                removeEventListenerFromSandboxes(eventObj.userType, sandboxMouseListener,
-                            eventObj.useCapture, event.target as IEventDispatcher);
+				removeEventListenerFromOtherSystemManagers(request.eventType, otherSystemManagerMouseListener, request.useCapture);
+                removeEventListenerFromSandboxes(request.eventType, sandboxMouseListener,
+                            request.useCapture, event.target as IEventDispatcher);
                 if (getSandboxRoot() == this)
                     super.removeEventListener(actualType, eventProxy.marshalListener,
-                            eventObj.useCapture);
+                            request.useCapture);
             }
-            // trace("<<eventListenerRequestHandler REMOVE ", this, eventObj.userType);
         }
 	}
 }


Amending last commit.

Amending last commit.

Modified SpatialIndex to use exact geometry probing with a buffer
which works as expected. It either gets the exact key that overlaps or
then nearest key which intersects the buffer for all plotters.

Fixed zooming in the vis tools by using a clip rectangle to clip the
drawing of the shape to the screenBounds. This keeps the line chart
and compound bar chart (for example) from overlapping the axes.
Also trimmed the probing for these to the dataBounds to prevent
offscreen probing.

Tested with kyle.xml and obesity.xml by verifying selection and
probing works as expected.

Change-Id: Ibbd8b71ab211d2c24d539ab2c5013fbcd06bc0d0

--- WeaveUI/src/weave/utils/SpatialIndex.as
+++ WeaveUI/src/weave/utils/SpatialIndex.as
@@ -58,7 +58,7 @@
 	 */
 	public class SpatialIndex extends CallbackCollection implements ISpatialIndex
 	{
-		// TODO: Refactor to use image/color hits instead
+		// TODO: Refactor to use image/color hits instead. The image hits should use some sort of trapezoidal or triangular grid.

 		public function SpatialIndex(callback:Function = null, callbackParameters:Array = null)
 		{


Change variable name to start with lowercase.

--- Bin/Data/Scripts/Editor/EditorSettings.as
+++ Bin/Data/Scripts/Editor/EditorSettings.as
@@ -40,8 +40,8 @@
     CheckBox@ mouseWheelCameraPositionToggle = settingsDialog.GetChild("MouseWheelCameraPositionToggle", true);
     mouseWheelCameraPositionToggle.checked = mouseWheelCameraPosition;

-    DropDownList@ MouseOrbitEdit = settingsDialog.GetChild("MouseOrbitEdit", true);
-    MouseOrbitEdit.selection = mouseOrbitMode;
+    DropDownList@ mouseOrbitEdit = settingsDialog.GetChild("MouseOrbitEdit", true);
+    mouseOrbitEdit.selection = mouseOrbitMode;

     LineEdit@ distanceEdit = settingsDialog.GetChild("DistanceEdit", true);
     distanceEdit.text = String(newNodeDistance);
@@ -109,7 +109,7 @@
         SubscribeToEvent(speedEdit, "TextFinished", "EditCameraSpeed");
         SubscribeToEvent(limitRotationToggle, "Toggled", "EditLimitRotation");
         SubscribeToEvent(mouseWheelCameraPositionToggle, "Toggled", "EditMouseWheelCameraPosition");
-        SubscribeToEvent(MouseOrbitEdit, "ItemSelected", "EditMouseOrbitMode");
+        SubscribeToEvent(mouseOrbitEdit, "ItemSelected", "EditMouseOrbitMode");
         SubscribeToEvent(distanceEdit, "TextChanged", "EditNewNodeDistance");
         SubscribeToEvent(distanceEdit, "TextFinished", "EditNewNodeDistance");
         SubscribeToEvent(moveStepEdit, "TextChanged", "EditMoveStep");


Transferred from the Adobe Open Source Subversion Repository

Revision: 23247
Author:   cframpto@adobe.com
Date:     2011-12-20T19:21:13.134833Z

Log Message:
-----------
Remove ADOBE SYSTEMS license and replace with Apache license in headers - frameworks.  A 2nd pass will be needed to get the files not handled up by the scripts.

Modified Paths:
--------------
4959 paths were modified

git-svn-id: 7146a936b37d36e51ea0d66f8acbe0b8281bc7b7@1269582 13f79535-47bb-0310-9956-ffa450edef68

--- frameworks/projects/mx/src/mx/events/DataGridEvent.as
+++ frameworks/projects/mx/src/mx/events/DataGridEvent.as
@@ -1,11 +1,19 @@
 ////////////////////////////////////////////////////////////////////////////////
 //
-//  ADOBE SYSTEMS INCORPORATED
-//  Copyright 2005-2007 Adobe Systems Incorporated
-//  All Rights Reserved.
+//  Licensed to the Apache Software Foundation (ASF) under one or more
+//  contributor license agreements.  See the NOTICE file distributed with
+//  this work for additional information regarding copyright ownership.
+//  The ASF licenses this file to You under the Apache License, Version 2.0
+//  (the "License"); you may not use this file except in compliance with
+//  the License.  You may obtain a copy of the License at
 //
-//  NOTICE: Adobe permits you to use, modify, and distribute this file
-//  in accordance with the terms of the license agreement accompanying it.
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+//  Unless required by applicable law or agreed to in writing, software
+//  distributed under the License is distributed on an "AS IS" BASIS,
+//  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//  See the License for the specific language governing permissions and
+//  limitations under the License.
 //
 ////////////////////////////////////////////////////////////////////////////////


Transferred from the Adobe Open Source Subversion Repository

Revision: 10685
Author:   gosmith@adobe.com
Date:     2009-09-29T16:48:44.296312Z

Log Message:
-----------
Addressed most of the FIXMEs in TLFTextField. The main changes are:

It now starts listening for the 'render' event only when it becomes invalid, and stops listening when it has been validated. Previously, it listened for the 'render' event whenever it was onstage. This change should improve performance.

It now uses a static TextField to initialize the defaultTextFormat rather than creating a TextFormat object and filling it out.

The logic to avoid getting or setting the scrollRect property unless it non-null is now in overrides of scrollRect.

The value of condenseWhite used to process the htmlText is now the value when htmlText is set. Previously, it was the value at render time, which could be different.

The validateNow() method now does no work if neither the TextLines nor the Graphics are invalid.

A background (at alpha = 0 if background == false) is always drawn now, to provide the correct mouse bounds.

It now invalidates in response to INLINE_GRAPHIC_STATUS_CHANGE events from the TextFlow, to handle asynchronous <img>s.

QE notes: None
Doc notes: None
Bugs: SDK-23443
Reviewer: Ryan
Tests run: ant checkintests
Is noteworthy for integration: No

Modified Paths:
--------------
/flex/sdk/trunk/frameworks/projects/spark/src/mx/core/TLFTextField.as

git-svn-id: 7146a936b37d36e51ea0d66f8acbe0b8281bc7b7@1277882 13f79535-47bb-0310-9956-ffa450edef68

--- frameworks/projects/spark/src/mx/core/FTETextField.as
+++ frameworks/projects/spark/src/mx/core/FTETextField.as
@@ -21,6 +21,7 @@
 import flash.events.TextEvent;
 import flash.geom.Rectangle;
 import flash.text.StyleSheet;
+import flash.text.TextField;
 import flash.text.TextFieldAutoSize;
 import flash.text.TextFieldType;
 import flash.text.TextFormat;
@@ -51,14 +52,13 @@
 import flashx.textLayout.elements.LinkElement;
 import flashx.textLayout.elements.TextFlow;
 import flashx.textLayout.events.FlowElementMouseEvent;
+import flashx.textLayout.events.StatusChangeEvent;
 import flashx.textLayout.factory.TextFlowTextLineFactory;
 import flashx.textLayout.formats.ITextLayoutFormat;
 import flashx.textLayout.formats.LeadingModel;
 import flashx.textLayout.formats.LineBreak;
 import flashx.textLayout.formats.TextDecoration;
 import flashx.textLayout.formats.TextLayoutFormat;
-
-import mx.core.mx_internal;

 use namespace mx_internal;

@@ -180,12 +180,11 @@
 	 *  Masks for bits inside the 'flags' var
 	 *  tracking misc boolean variables.
 	 */
-	private static const FLAG_VALIDATE_IN_PROGRESS:uint = 1 << 10;
-	private static const FLAG_USE_TCM:uint = 1 << 11;
+	private static const FLAG_EFFECTIVE_CONDENSE_WHITE:uint = 1 << 10;
+	private static const FLAG_VALIDATE_IN_PROGRESS:uint = 1 << 11;
 	private static const FLAG_HAS_SCROLL_RECT:uint = 1 << 12;
-		// FIXME (gosmith): should be set in override of set scrollRect?

-	// FIXME (gosmith): Does TextField maintain
+	// TODO (gosmith): Does TextField maintain
 	// an internal vs. external concept of scrollRect?

 	/**
@@ -205,6 +204,12 @@

 	/**
 	 *  @private
+	 *  Used for initializing _defaultTextFormat.
+	 */
+	private static var textField:TextField = new TextField();
+
+	/**
+	 *  @private
 	 */
 	private static var plainTextImporter:ITextImporter;

@@ -278,37 +283,6 @@
 		if (i - 0.5 == x && i & 1)
 			--i;
 		return i;
-	}
-
-	/**
-	 *  @private
-	 */
-	private static function createDefaultTextFormat():TextFormat
-	{
-		var textFormat:TextFormat = new TextFormat(
-			"Times New Roman",		// font // FIXME (gosmith): platform-dependent?
-			12,						// size
-			0x000000,				// color
-			false,					// bold
-			false,					// italic
-			false,					// underline
-			"",						// url
-			"",						// target
-			TextFormatAlign.LEFT,	// align
-			0,						// leftMargin
-			0,						// rightMargin
-			0,						// indent
-			0);						// leading
-
-		textFormat.blockIndent = 0;
-		textFormat.bullet = false;
-		textFormat.kerning = false;
-		textFormat.letterSpacing = 0;
-		textFormat.tabStops = [];
-			// FIXME (gosmith): Flash apparently detects when an empty array
-			// is assigned to tabStops and assigns null instead.
-
-		return textFormat;
 	}

 	/**
@@ -415,7 +389,12 @@
 		// events over each line, thich TextField doesn't do.
 		mouseChildren = false;

-		_defaultTextFormat = createDefaultTextFormat();
+		// Use a static TextField to initialize the defaultTextFormat.
+		// This should be faster than creating a TextFormat object
+		// and filling it out.
+		// It will also take care of setting the 'font' field,
+		// which is platform-dependent.
+		_defaultTextFormat = textField.defaultTextFormat;

 		addEventListener(Event.ADDED_TO_STAGE, addedToStageHandler);
 	}
@@ -521,6 +500,37 @@
 				FLAG_GRAPHICS_INVALID);

 		invalidate();
+	}
+
+	//----------------------------------
+	//  scrollRect
+	//----------------------------------
+
+	/*
+	 *  Workaround for a Flash Player problem.
+	 *  Don't read the scrollRect property if its value has not been set,
+	 *  because this will cause a large memory allocation.
+	 *  And ignore attempts to reset the scrollRect property to null
+	 *  (its default value) if we've never set it.
+	 */
+
+	/**
+	 *  @private
+	 */
+	override public function get scrollRect():Rectangle
+	{
+		return testFlag(FLAG_HAS_SCROLL_RECT) ? super.scrollRect : null;
+	}
+
+	/**
+	 *  @private
+	 */
+	override public function set scrollRect(value:Rectangle):void
+	{
+		if (!testFlag(FLAG_HAS_SCROLL_RECT) && !value)
+			return;
+		setFlag(FLAG_HAS_SCROLL_RECT);
+		super.scrollRect = value;
 	}

 	//----------------------------------
@@ -880,9 +890,6 @@
 	{
 		setFlagToValue(FLAG_CONDENSE_WHITE, value);

-		// FIXME (gosmith): Need to cache this so that if you then set
-		// htmlText and change condenseWhite, the old value is used.
-
 		// Note: There is nothing else to do immediately;
 		// the new value doesn't have any effect
 		// until 'htmlText' is set later.
@@ -1056,21 +1063,25 @@
 	 */
 	public function get htmlText():String
 	{
-		// FIXME (gosmith): Explain this.
+		// When 'text' is set, _htmlText is nulled out
+		// to indicate that it is invalid
+		// and must be recalculated.
 		if (_htmlText == null)
 		{
+			// We can optimize the default case
+			// that there is no text or hmtlText.
 			if (_text == "")
 			{
 				_htmlText = "";
 			}
 			else
 			{
+				// Import the plain text into a TextFlow,
+				// and then export the TextFlow into HTML.
 				if (!textFlow)
 					textFlow = plainTextImporter.importToFlow(_text);
 				_htmlText = String(htmlExporter.export(
 					textFlow, ConversionType.STRING_TYPE));
-
-				// FIXME (gosmith): Are newlines \r or \n, or none?
 			}
 		}

@@ -1091,9 +1102,15 @@
 			throw new TypeError("Parameter text must be non-null.");
 		}

-		// FIXME (gosmith): Explain why we don't do this.
-		//    	if (value == htmlText)
-		//    		return;
+		// Note: We don't return early if value == _htmlText
+		// because the defaultTextFormat may have changed
+		// in which case we need to recompose.
+
+		// Remember the value of condenseWhite at the time
+		// that htmlText is set, because it could be changed
+		// before the TextLines are rendered.
+		setFlagToValue(FLAG_EFFECTIVE_CONDENSE_WHITE,
+					   testFlag(FLAG_CONDENSE_WHITE));

 		_htmlText = value;

@@ -1473,7 +1490,8 @@
 	 */
 	public function get styleSheet():StyleSheet
 	{
-		return _styleSheet; // FIXME (gosmith): return copy?
+		// Note: TextField does NOT return a copy of the StyleSheet.
+		return _styleSheet;
 	}

 	/**
@@ -1484,9 +1502,9 @@
 		// TextField allows a null value to be set;
 		// in fact, this is the default.

-		// FIXME (gosmith): Explain why we don't do this.
-		//if (value == _styleSheet)
-		//	return;
+		// Note: We don't return early if value == _styleSheet
+		// because the same StyleSheet instance could be coming
+		// in again but might have new values in it.

 		_styleSheet = value;

@@ -1519,16 +1537,23 @@
 	 */
 	public function get text():String
 	{
-		// Explain this.
+		// When 'htmlText' is set, _text is nulled out
+		// to indicate that it is invalid
+		// and must be rexported from the TextFlow.
 		if (_text == null)
 		{
+			// If we don't already have a TextFlow,
+			// create one by importing the htmlText.
 			if (!textFlow)
 				textFlow = htmlImporter.importToFlow(_htmlText);

+			// Export plain text from the TextFlow.
 			_text = String(plainTextExporter.export(
 				textFlow, ConversionType.STRING_TYPE));

-			// FIXME (gosmith): line endings should be changed from \n to \r?
+			// Convert the LF characters that TLF exports
+			// into CR characters.
+			_text = _text.replace(ALL_LINEFEEDS, "\r");
 		}

 		return _text;
@@ -1543,7 +1568,9 @@
 		if (value == null)
 			throw new TypeError("Parameter text must be non-null.");

-		// FIXME (gosmith)
+		// Note: We don't return early if value == _text
+		// because the defaultTextFormat may have changed
+		// in which case we need to recompose.

 		// TextField turns all LF characters into CR characters,
 		// including treating the Windows line-ending-sequence
@@ -1588,10 +1615,9 @@
 	 */
 	public function set textColor(value:uint):void
 	{
-		// FIXME (gosmith): Should this be commented out?
-		//if (value == _textColor)
-		//	return;
-
+		if (value == textColor)
+			return;
+
 		_defaultTextFormat.color = value;

 		setFlag(FLAG_TEXT_LINES_INVALID);
@@ -1702,7 +1728,7 @@
 		}

 		if (value == TextFieldType.INPUT)
-			throw new Error("FIXME (gosmith)");
+			throw new Error("TLFTextField does not support setting type to \"input\".");
 	}

 	//----------------------------------
@@ -1920,7 +1946,8 @@
 		// TLFTextField allows a null value to be set;
 		// in fact, this is the default.

-		//FIXME (gosmith): set to existing value?
+		if (value == _textLineCreator)
+			return;

 		_textLineCreator = value;

@@ -1947,7 +1974,14 @@
 	 */
 	private function get htmlImporter():ITextImporter
 	{
-		return condenseWhite ? collapsingHTMLImporter : preservingHTMLImporter;
+		// Note that which importer we return depends on the value
+		// of condenseWhite was at the time that htmlText was set,
+		// not on the current value of condenseWhite,
+		// since it could change between htmlText being set
+		// and the TextLines being composed.
+		return testFlag(FLAG_EFFECTIVE_CONDENSE_WHITE) ?
+			   collapsingHTMLImporter :
+			   preservingHTMLImporter;
 	}

 	//--------------------------------------------------------------------------
@@ -2162,7 +2196,7 @@
 		// you call getTextFormat(); the proof is that
 		//   textField.getTextFormat() != textField.getTextFormat()
 		// is true.
-		return cloneTextFormat(_defaultTextFormat); // FIXME (gosmith) return null?
+		return cloneTextFormat(_defaultTextFormat);
 	}

 	/**
@@ -2263,6 +2297,7 @@
 	 */
 	private function notImplemented(name:String):String
 	{
+		// FIXME (gosmith) Make this an other RTE messages localizable.
 		return "'" + name + "' is not implemented TLFTextField.";
 	}

@@ -2302,13 +2337,10 @@
 	 */
 	private function invalidate():void
 	{
-		//FIXME (gosmith)
-		//CONFIG::debug { assert(!testFlag(FLAG_VALIDATE_IN_PROGRESS), "invalidating during validateNow()"); }
-
 		if (stage)
 			stage.invalidate();

-		// FIXME (gosmith): do addEventListener() for 'render' here
+		addEventListener(Event.RENDER, renderHandler);
 	}

 	/**
@@ -2320,7 +2352,7 @@
 	 */
 	private function validateNow():void
 	{
-		// FIXME (gosmith): When do we get recursive validateNow()?
+		// TODO (gosmith): When do we get recursive validateNow()?
 		if (!testFlag(ALL_INVALIDATION_FLAGS) ||
 			testFlag(FLAG_VALIDATE_IN_PROGRESS))
 		{
@@ -2331,14 +2363,6 @@

 		if (testFlag(FLAG_TEXT_LINES_INVALID))
 		{
-			// Determine whether we will use FTE directly
-			// or TLF's TextContainerManager.
-			// FIXME (gosmith): What about tabStops?
-			var useTCM:Boolean = testFlag(FLAG_HTML_TEXT_CHANGED) ||
-								 _defaultTextFormat.target != "" ||
-								 _defaultTextFormat.url != ""; // FIXME (gosmith): forget this
-			setFlagToValue(FLAG_USE_TCM, useTCM); // FIXME (gosmith): kill this flag
-
 			// Remove the previous TextLines
 			// (and recycle them, if supported by the player).
 			removeTextLines();
@@ -2356,74 +2380,60 @@
 				compositionWidth = _width;
 			}

-			if (!useTCM)
+			if (testFlag(FLAG_HTML_TEXT_CHANGED))
+			{
+				if (!hostFormat)
+					createHostFormat();
+
+				composeHTMLText(compositionWidth, compositionHeight);
+			}
+			else
 			{
 				if (!elementFormat)
 					createElementFormat();

 				composeText(compositionWidth, compositionHeight);
 			}
-			else
+
+			var origX:Number = x;
+			var origWidth:Number = _width;
+			var origHeight:Number = _height;
+
+			if (_autoSize != TextFieldAutoSize.NONE)
 			{
-				if (!hostFormat)
-					createHostFormat();
-
-				composeHTMLText(compositionWidth, compositionHeight);
+				_height = _textHeight + PADDING_TOP + PADDING_BOTTOM;
+				if (!wordWrap)
+				{
+					_width = _textWidth + PADDING_LEFT + PADDING_RIGHT;
+
+					// adjust x for CENTER and RIGHT cases
+					if (_autoSize == TextFieldAutoSize.RIGHT)
+						x += origWidth - _width;
+					else if (_autoSize == TextFieldAutoSize.CENTER)
+						x += (origWidth - _width) / 2;
+				}
+				if (_height != origHeight || _width != origWidth || x != origX)
+					setFlag(FLAG_GRAPHICS_INVALID);
 			}
-		}
-
-		// FIXME (gosmith): Does this belong inside the previous block?
-		var origX:Number = x;
-		var origWidth:Number = _width;
-		var origHeight:Number = _height;
-
-		if (_autoSize != TextFieldAutoSize.NONE)
-		{
-			_height = _textHeight + PADDING_TOP + PADDING_BOTTOM;
-			if (!wordWrap)
+
+			if (_textWidth > origWidth || _textHeight > origHeight)
 			{
-				_width = _textWidth + PADDING_LEFT + PADDING_RIGHT;
-
-				// adjust x for CENTER and RIGHT cases
-				if (_autoSize == TextFieldAutoSize.RIGHT)
-					x += origWidth - _width;
-				else if (_autoSize == TextFieldAutoSize.CENTER)
-					x += (origWidth - _width) / 2;
+				// need to clip
+				//trace("clip");
+				var r:Rectangle = scrollRect;
+				if (!r)
+					r = new Rectangle();
+				r.left = 0;
+				r.top = 0;
+				r.right = _width;
+				r.bottom = _height;
+				scrollRect = r;
 			}
-			if (_height != origHeight || _width != origWidth || x != origX)
-				setFlag(FLAG_GRAPHICS_INVALID);
-		}
-
-		if (_textWidth > origWidth || _textHeight > origHeight)
-		{
-			// need to clip
-			//trace("clip");
-			/*
-			if (border)
+			else
 			{
-				// trying to match TextField behavior of border
-				r.width += 1;
-				r.height += 1;
-			}
-			*/
-			var r:Rectangle = scrollRect;
-			if (!r)
-				r = new Rectangle();
-			r.left = 0;
-			r.top = 0;
-			r.right = _width;
-			r.bottom = _height;
-			scrollRect = r;
-			setFlag(FLAG_HAS_SCROLL_RECT);
-		}
-		else
-		{
-			// don't need to clip
-			//trace("don't clip");
-			if (testFlag(FLAG_HAS_SCROLL_RECT))
-			{
+				// don't need to clip
+				//trace("don't clip");
 				scrollRect = null;
-				clearFlag(FLAG_HAS_SCROLL_RECT);
 			}
 		}

@@ -2436,19 +2446,19 @@
 			// First draw the background, then draw the border.
 			// This is because TextField actually does something strange --- it expands itselft 1 pixel right and down when drawing a border
 			// and fill without the stroke with the required stroking path does not match the "background sans border" behavior of TextField.
-			if (background)
-			{
-				// Width/Height rounding differences between TextField and TLFTextField...
-				// For width or height of the form E.5 where E is a positive even integer, Flash 10 on Windows seems to
-				// "round to even", i.e., round the dimension down to E rather than up to E+1. However we currently just
-				// round consistently up to E+1 using Math.round() here since for now are willing to live with this difference.
-				var w:Number = rint(_width);
-				var h:Number = rint(_height);
+
+			// Width/Height rounding differences between TextField and TLFTextField...
+			// For width or height of the form E.5 where E is a positive even integer, Flash 10 on Windows seems to
+			// "round to even", i.e., round the dimension down to E rather than up to E+1. However we currently just
+			// round consistently up to E+1 using Math.round() here since for now are willing to live with this difference.
+			var w:Number = rint(_width);
+			var h:Number = rint(_height);

-				g.beginFill(backgroundColor);
-				g.drawRect(0, 0, w, h);
-				g.endFill();
-			}
+			// Even if no background is requested, we fill the bounds
+			// with alpha=0 pixels so that mouse events are generated.
+			g.beginFill(backgroundColor, background ? 1.0 : 0.0);
+			g.drawRect(0, 0, w, h);
+			g.endFill();

 			if (border)
 			{
@@ -2495,7 +2505,7 @@

 		elementFormat.locale = locale;

-		elementFormat.trackingRight = Number(_defaultTextFormat.letterSpacing); // FIXME (gosmith): 1/2 left, 1/2 right?
+		elementFormat.trackingRight = Number(_defaultTextFormat.letterSpacing);
 	}

 	/**
@@ -2504,70 +2514,6 @@
 	private function createHostFormat():void
 	{
 		hostFormat = new TLFTextFieldHostFormat(this);
-
-		/*
-		//FIXME (gosmith)
-
-		hostFormat = new TextLayoutFormat();
-
-		hostFormat.color = _defaultTextFormat.color;
-
-		hostFormat.fontFamily = _defaultTextFormat.font;
-
-		hostFormat.fontLookup = embedFonts ?
-								FontLookup.EMBEDDED_CFF :
-								FontLookup.DEVICE;
-
-		hostFormat.fontSize = _defaultTextFormat.size;
-
-		hostFormat.fontStyle = _defaultTextFormat.italic ?
-							   FontPosture.ITALIC :
-							   FontPosture.NORMAL;
-
-		hostFormat.fontWeight = _defaultTextFormat.bold ?
-								FontWeight.BOLD :
-								FontWeight.NORMAL;
-
-		hostFormat.kerning = _defaultTextFormat.kerning ?
-							 Kerning.AUTO :
-							 Kerning.OFF;
-
-		hostFormat.leadingModel = LeadingModel.ASCENT_DESCENT_UP;
-
-		hostFormat.lineBreak = wordWrap ?
-							   LineBreak.TO_FIT :
-							   LineBreak.EXPLICIT;
-
-		hostFormat.lineHeight = 2 + _defaultTextFormat.leading; // FIXME (gosmith)
-
-		hostFormat.locale = locale;
-
-		hostFormat.paddingBottom = PADDING_BOTTOM;
-
-		hostFormat.paddingLeft = PADDING_LEFT;
-
-		hostFormat.paddingRight = PADDING_RIGHT;
-
-		hostFormat.paddingTop = PADDING_TOP;
-
-		hostFormat.paragraphEndIndent = _defaultTextFormat.rightMargin;
-
-		hostFormat.paragraphStartIndent = _defaultTextFormat.leftMargin;
-
-		hostFormat.tabStops = _defaultTextFormat.tabStops; // FIXME (gosmith)
-
-		hostFormat.textAlign = _defaultTextFormat.align;
-
-		hostFormat.textAlignLast = _defaultTextFormat.align;
-
-		hostFormat.textDecoration = _defaultTextFormat.underline ?
-									TextDecoration.UNDERLINE :
-									TextDecoration.NONE;
-
-		hostFormat.textIndent = _defaultTextFormat.indent;
-
-		hostFormat.trackingRight = _defaultTextFormat.letterSpacing;
-		*/
 	}

 	/**
@@ -2602,7 +2548,6 @@
 		var innerHeight:Number =
 			compositionHeight - PADDING_TOP - PADDING_BOTTOM;

-		// FIXME (gosmith)
 		var emBox:Rectangle = elementFormat.getFontMetrics().emBox;
 		var ascent:int = Math.round(emBox.height);
 		var descent:int = Math.round(emBox.bottom);
@@ -2644,7 +2589,6 @@
 		// are correctly aligned and inset by the left and top padding.
 		alignTextLines(innerWidth);

-		// FIXME (gosmith)
 		_textWidth = Math.round(_textWidth);
 		_textHeight = Math.round(
 			numChildren * (ascent + descent) +
@@ -2683,7 +2627,6 @@
 			_defaultTextFormat.align == "justify" ?
 			LineJustification.ALL_BUT_LAST :
 			LineJustification.UNJUSTIFIED;;
-		//FIXME (gosmith) staticSpaceJustifier.letterSpacing
 		staticTextBlock.textJustifier = staticSpaceJustifier;

 		// Then create and add TextLines using this TextBlock.
@@ -2774,19 +2717,13 @@
 			else
 				nextY += descent + _defaultTextFormat.leading + ascent;

-			// If the next line is completely outside the rectangle,
-			// we're done.
-//			if (nextY - nextTextLine.ascent > innerHeight)
-//				break;
-
 			// We'll keep this line.
 			textLine = nextTextLine;
-			n++; // FIXME (gosmith): remove counter
+			n++;

 			// Assign its location based on left/top alignment.
 			// Its x position is 0 by default.
 			textLine.y = nextY;
-			//trace(textLine.y);

 			if (_defaultTextFormat.underline)
 			{
@@ -2860,10 +2797,13 @@
 	private function composeHTMLText(compositionWidth:Number,
 									 compositionHeight:Number):void
 	{
-		// FIXME (gosmith): if (!textFlow) ?
 		textFlow = htmlImporter.importToFlow(_htmlText);

 		textFlow.addEventListener(MouseEvent.CLICK, linkClickHandler);
+
+		textFlow.addEventListener(
+			StatusChangeEvent.INLINE_GRAPHIC_STATUS_CHANGE,
+			inlineGraphicStatusChangeHandler);

 		if (!textContainerManager)
 			textContainerManager = new TLFTextFieldTextContainerManager(this);
@@ -2892,12 +2832,9 @@
 		textContainerManager.updateContainer();

 		var bounds:Rectangle = textContainerManager.getContentBounds();
-		_textWidth = Math.ceil(bounds.width); // FIXME (gosmith): round?
-		_textHeight = Math.ceil(bounds.height);
-	}
-
-	// FIXME (gosmith): listen for events
-	// when asynchronous images are loaded to resize?
+		_textWidth = Math.round(bounds.width);
+		_textHeight = Math.round(bounds.height);
+	}

 	//--------------------------------------------------------------------------
 	//
@@ -2910,30 +2847,17 @@
 	 */
 	private function addedToStageHandler(event:Event):void
 	{
-		// Having renderHandler() attached only while on the stage
-		// gives a performance improvement.
-		removeEventListener(Event.ADDED_TO_STAGE, addedToStageHandler);
-		addEventListener(Event.RENDER, renderHandler);
-		addEventListener(Event.REMOVED_FROM_STAGE, removedFromStageHandler);
+		invalidate();
+	}
+
+	/**
+	 *  @private
+	 */
+	private function renderHandler(event:Event):void
+	{
 		validateNow();
-	}
-
-	/**
-	 *  @private
-	 */
-	private function removedFromStageHandler(event:Event):void
-	{
+
 		removeEventListener(Event.RENDER, renderHandler);
-		removeEventListener(Event.REMOVED_FROM_STAGE, removedFromStageHandler);
-		addEventListener(Event.ADDED_TO_STAGE, addedToStageHandler);
-	}
-
-	/**
-	 *  @private
-	 */
-	private function renderHandler(event:Event):void // FIXME (gosmith): don't keep this around
-	{
-		validateNow();
 	}

 	/**
@@ -2944,15 +2868,27 @@
 		// Need to remove the event: portion of the href if it has one.
 		// Only dispatch the event if it has the event portion.
 		var href:String = LinkElement(event.flowElement).href;
-		var i:int = href.search("event:"); // FIXME (gosmith): indexOf; need starts-with logic
-		if (i < 0)
-			return;
-		var textEvent:TextEvent = new TextEvent(TextEvent.LINK);
-		textEvent.text = href.substring(i + 6, href.length - i + 5);
-		dispatchEvent(textEvent);
+		if (href.indexOf("event:") == 0)
+		{
+			var textEvent:TextEvent = new TextEvent(TextEvent.LINK);
+			textEvent.text = href.substring(6);
+			dispatchEvent(textEvent);
+		}
+	}
+
+	/**
+	 *  @private
+	 */
+	private function inlineGraphicStatusChangeHandler(
+									event:StatusChangeEvent):void
+	{
+		setFlag(FLAG_TEXT_LINES_INVALID |
+				FLAG_GRAPHICS_INVALID);
+
+		invalidate();
 	}
 }
-
+
 }

 import flash.display.Sprite;
@@ -3224,7 +3160,7 @@

 	public function get tabStops():*
 	{
-		return textField._defaultTextFormat.tabStops; // FIXME (gosmith)
+		return undefined;
 	}

 	public function get textAlign():*
@@ -3266,7 +3202,7 @@

 	public function get trackingLeft():*
 	{
-		return undefined; // FIXME (gosmith): divide letterSpacing in 2?
+		return undefined;
 	}

 	public function get trackingRight():*
@@ -3305,12 +3241,13 @@
     //--------------------------------------------------------------------------

     /**
-     *  Map of TextField StyleSheet css properties to their equivalent
-     *  TLF properties.  This is only the styles which have different names.
+     *  Map of TextField StyleSheet CSS properties to their equivalent
+     *  TLF properties. This is only the styles which have different names.
      */
-    private static const textFieldToTLFStyleMap:Object = {
-        // FIXME(gosmith): when mapping leading to lineHeight does this need the
-        // same adjustment as  TLFTextFieldHostFormat.lineHeight?
+    private static const textFieldToTLFStyleMap:Object =
+	{
+        // FIXME (gosmith): when mapping leading to lineHeight does this need
+        // the same adjustment as TLFTextFieldHostFormat.lineHeight?
         "leading": "lineHeight",
         "letterSpacing": "trackingRight",
         "marginLeft": "paragraphStartIndent",