     //
     //--------------------------------------------------------------------------
 
+
+    /**
+     * @private
+     * Called if we are in touch interaction mode and we receive a mouseDown
+     */  
+    private function touchMouseDownHandler(event:MouseEvent):void
+    {
+        isMouseDown = true;
+        mouseDownTarget = event.target as InteractiveObject;
+                
+        // Wait for a mouseUp somewhere
+        systemManager.getSandboxRoot().addEventListener(
+            MouseEvent.MOUSE_UP, touchMouseUpHandler, false, 0, true);
+        systemManager.getSandboxRoot().addEventListener(
+            SandboxMouseEvent.MOUSE_UP_SOMEWHERE, touchMouseUpHandler, false, 0, true);
+    }
+    
+    /**
+     * @private
+     * Called if we are in touch interaction mode and a mouseUp occurs on the stage while isMouseDown is true
+     */ 
+    private function touchMouseUpHandler(event:Event):void
+    {        
+        /* 
+         We set the focus on the component on mouseUp to activate the softKeyboard   
+         We only set focus if the following conditions are met:
+         1. mouseUp occurs on this component
+         2. mouseDown occured on any subcomponent besides the textDisplay OR
+         mouseDown occurred on textDisplay and mouseUp did not occur on textDisplay
+        
+         The mouseDown and mouseUp on textDisplay case is handled by the Player
+        */        
+        if ((event.target is DisplayObject && contains(DisplayObject(event.target))) 
+            && (delaySetFocus ||
+             (mouseDownTarget == textDisplay && event.target != textDisplay)))
+        {
+            if (textDisplay)
+                textDisplay.setFocus();
+        }
+        
+        clearMouseDownState();
+    }
+       
+    /**
+     * @private
+     * Called if we are inside of a Scroller and the user has started a scroll gesture
+     */
+    private function touchInteractionStartHandler(event:TouchInteractionEvent):void
+    {
+        // Clear out the state because starting a scroll gesture should never 
+        // open the soft keyboard
+        clearMouseDownState();
+    }    
+    
+    /**
+     * @private
+     * Helper function to clear the state if the mouse is up or we started as scroll gesture
+     */
+    private function clearMouseDownState():void
+    {
+        if (isMouseDown)
+        {
+            systemManager.getSandboxRoot().removeEventListener(
+                MouseEvent.MOUSE_UP, touchMouseUpHandler, false);
+            systemManager.getSandboxRoot().removeEventListener(
+                SandboxMouseEvent.MOUSE_UP_SOMEWHERE, touchMouseUpHandler, false);
+            isMouseDown = false;
+            delaySetFocus = false;
+            mouseDownTarget = null;
+        }
+    }
+    
     /**
      *  @private
      *  Called when the RichEditableText dispatches a 'selectionChange' event.

            accessibilityPropertiesChanged = false;
        }
    }

    /**
     *  @private


import mx.core.IIMESupport;
import mx.core.IVisualElement;
import mx.core.InteractionMode;
import mx.core.mx_internal;
import mx.events.FlexEvent;
import mx.events.SandboxMouseEvent;
import mx.events.TouchInteractionEvent;
import mx.managers.IFocusManagerComponent;
import mx.utils.BitFlagUtil;

