home *** CD-ROM | disk | FTP | other *** search
/ Computer Active 2010 August / CA08.iso / Multimedija / shufflr.air / ShufflrClient.swf / scripts / mx / managers / CursorManagerImpl.as < prev    next >
Encoding:
Text File  |  2010-06-23  |  26.1 KB  |  763 lines

  1. package mx.managers
  2. {
  3.    import flash.display.DisplayObject;
  4.    import flash.display.DisplayObjectContainer;
  5.    import flash.display.InteractiveObject;
  6.    import flash.display.Sprite;
  7.    import flash.events.ContextMenuEvent;
  8.    import flash.events.Event;
  9.    import flash.events.EventDispatcher;
  10.    import flash.events.IEventDispatcher;
  11.    import flash.events.IOErrorEvent;
  12.    import flash.events.MouseEvent;
  13.    import flash.events.ProgressEvent;
  14.    import flash.geom.Point;
  15.    import flash.text.TextField;
  16.    import flash.text.TextFieldType;
  17.    import flash.ui.Mouse;
  18.    import mx.core.ApplicationGlobals;
  19.    import mx.core.EventPriority;
  20.    import mx.core.FlexSprite;
  21.    import mx.core.mx_internal;
  22.    import mx.events.InterManagerRequest;
  23.    import mx.events.SWFBridgeRequest;
  24.    import mx.events.SandboxMouseEvent;
  25.    import mx.styles.CSSStyleDeclaration;
  26.    import mx.styles.StyleManager;
  27.    
  28.    use namespace mx_internal;
  29.    
  30.    public class CursorManagerImpl implements ICursorManager
  31.    {
  32.       private static var instance:ICursorManager;
  33.       
  34.       mx_internal static const VERSION:String = "3.5.0.12683";
  35.       
  36.       private var showSystemCursor:Boolean = false;
  37.       
  38.       private var nextCursorID:int = 1;
  39.       
  40.       private var systemManager:ISystemManager = null;
  41.       
  42.       private var cursorList:Array = [];
  43.       
  44.       private var _currentCursorYOffset:Number = 0;
  45.       
  46.       private var cursorHolder:Sprite;
  47.       
  48.       private var currentCursor:DisplayObject;
  49.       
  50.       private var sandboxRoot:IEventDispatcher = null;
  51.       
  52.       private var showCustomCursor:Boolean = false;
  53.       
  54.       private var listenForContextMenu:Boolean = false;
  55.       
  56.       private var customCursorLeftStage:Boolean = false;
  57.       
  58.       private var _currentCursorID:int = 0;
  59.       
  60.       private var initialized:Boolean = false;
  61.       
  62.       private var overTextField:Boolean = false;
  63.       
  64.       private var _currentCursorXOffset:Number = 0;
  65.       
  66.       private var busyCursorList:Array = [];
  67.       
  68.       private var overLink:Boolean = false;
  69.       
  70.       private var sourceArray:Array = [];
  71.       
  72.       public function CursorManagerImpl(param1:ISystemManager = null)
  73.       {
  74.          super();
  75.          if(Boolean(instance) && !param1)
  76.          {
  77.             throw new Error("Instance already exists.");
  78.          }
  79.          if(param1)
  80.          {
  81.             this.systemManager = param1 as ISystemManager;
  82.          }
  83.          else
  84.          {
  85.             this.systemManager = SystemManagerGlobals.topLevelSystemManagers[0] as ISystemManager;
  86.          }
  87.          sandboxRoot = this.systemManager.getSandboxRoot();
  88.          sandboxRoot.addEventListener(InterManagerRequest.CURSOR_MANAGER_REQUEST,marshalCursorManagerHandler,false,0,true);
  89.          var _loc2_:InterManagerRequest = new InterManagerRequest(InterManagerRequest.CURSOR_MANAGER_REQUEST);
  90.          _loc2_.name = "update";
  91.          sandboxRoot.dispatchEvent(_loc2_);
  92.       }
  93.       
  94.       public static function getInstance() : ICursorManager
  95.       {
  96.          if(!instance)
  97.          {
  98.             instance = new CursorManagerImpl();
  99.          }
  100.          return instance;
  101.       }
  102.       
  103.       private function mouseOverHandler(param1:MouseEvent) : void
  104.       {
  105.          sandboxRoot.removeEventListener(MouseEvent.MOUSE_OVER,mouseOverHandler);
  106.          mouseMoveHandler(param1);
  107.       }
  108.       
  109.       public function set currentCursorYOffset(param1:Number) : void
  110.       {
  111.          var _loc2_:InterManagerRequest = null;
  112.          _currentCursorYOffset = param1;
  113.          if(!cursorHolder)
  114.          {
  115.             _loc2_ = new InterManagerRequest(InterManagerRequest.CURSOR_MANAGER_REQUEST);
  116.             _loc2_.name = "currentCursorYOffset";
  117.             _loc2_.value = currentCursorYOffset;
  118.             sandboxRoot.dispatchEvent(_loc2_);
  119.          }
  120.       }
  121.       
  122.       public function get currentCursorXOffset() : Number
  123.       {
  124.          return _currentCursorXOffset;
  125.       }
  126.       
  127.       public function removeCursor(param1:int) : void
  128.       {
  129.          var _loc2_:Object = null;
  130.          var _loc3_:InterManagerRequest = null;
  131.          var _loc4_:CursorQueueItem = null;
  132.          if(initialized && !cursorHolder)
  133.          {
  134.             _loc3_ = new InterManagerRequest(InterManagerRequest.CURSOR_MANAGER_REQUEST);
  135.             _loc3_.name = "removeCursor";
  136.             _loc3_.value = param1;
  137.             sandboxRoot.dispatchEvent(_loc3_);
  138.             return;
  139.          }
  140.          for(_loc2_ in cursorList)
  141.          {
  142.             _loc4_ = cursorList[_loc2_];
  143.             if(_loc4_.cursorID == param1)
  144.             {
  145.                cursorList.splice(_loc2_,1);
  146.                showCurrentCursor();
  147.                break;
  148.             }
  149.          }
  150.       }
  151.       
  152.       public function get currentCursorID() : int
  153.       {
  154.          return _currentCursorID;
  155.       }
  156.       
  157.       private function removeContextMenuHandlers() : void
  158.       {
  159.          var _loc1_:InteractiveObject = null;
  160.          var _loc2_:InteractiveObject = null;
  161.          if(listenForContextMenu)
  162.          {
  163.             _loc1_ = systemManager.document as InteractiveObject;
  164.             _loc2_ = systemManager as InteractiveObject;
  165.             if(Boolean(_loc1_) && Boolean(_loc1_.contextMenu))
  166.             {
  167.                _loc1_.contextMenu.removeEventListener(ContextMenuEvent.MENU_SELECT,contextMenu_menuSelectHandler,true);
  168.             }
  169.             if(Boolean(_loc2_) && Boolean(_loc2_.contextMenu))
  170.             {
  171.                _loc2_.contextMenu.removeEventListener(ContextMenuEvent.MENU_SELECT,contextMenu_menuSelectHandler,true);
  172.             }
  173.             listenForContextMenu = false;
  174.          }
  175.       }
  176.       
  177.       private function marshalMouseMoveHandler(param1:Event) : void
  178.       {
  179.          var _loc2_:SWFBridgeRequest = null;
  180.          var _loc3_:IEventDispatcher = null;
  181.          if(cursorHolder.visible)
  182.          {
  183.             cursorHolder.visible = false;
  184.             _loc2_ = new SWFBridgeRequest(SWFBridgeRequest.SHOW_MOUSE_CURSOR_REQUEST);
  185.             if(systemManager.useSWFBridge())
  186.             {
  187.                _loc3_ = systemManager.swfBridgeGroup.parentBridge;
  188.             }
  189.             else
  190.             {
  191.                _loc3_ = systemManager;
  192.             }
  193.             _loc2_.requestor = _loc3_;
  194.             _loc3_.dispatchEvent(_loc2_);
  195.             if(_loc2_.data)
  196.             {
  197.                Mouse.show();
  198.             }
  199.          }
  200.       }
  201.       
  202.       public function set currentCursorID(param1:int) : void
  203.       {
  204.          var _loc2_:InterManagerRequest = null;
  205.          _currentCursorID = param1;
  206.          if(!cursorHolder)
  207.          {
  208.             _loc2_ = new InterManagerRequest(InterManagerRequest.CURSOR_MANAGER_REQUEST);
  209.             _loc2_.name = "currentCursorID";
  210.             _loc2_.value = currentCursorID;
  211.             sandboxRoot.dispatchEvent(_loc2_);
  212.          }
  213.       }
  214.       
  215.       private function priorityCompare(param1:CursorQueueItem, param2:CursorQueueItem) : int
  216.       {
  217.          if(param1.priority < param2.priority)
  218.          {
  219.             return -1;
  220.          }
  221.          if(param1.priority == param2.priority)
  222.          {
  223.             return 0;
  224.          }
  225.          return 1;
  226.       }
  227.       
  228.       private function mouseOutHandler(param1:MouseEvent) : void
  229.       {
  230.          if(param1.relatedObject == null && cursorList.length > 0)
  231.          {
  232.             customCursorLeftStage = true;
  233.             hideCursor();
  234.             Mouse.show();
  235.          }
  236.       }
  237.       
  238.       public function setBusyCursor() : void
  239.       {
  240.          var _loc3_:InterManagerRequest = null;
  241.          if(initialized && !cursorHolder)
  242.          {
  243.             _loc3_ = new InterManagerRequest(InterManagerRequest.CURSOR_MANAGER_REQUEST);
  244.             _loc3_.name = "setBusyCursor";
  245.             sandboxRoot.dispatchEvent(_loc3_);
  246.             return;
  247.          }
  248.          var _loc1_:CSSStyleDeclaration = StyleManager.getStyleDeclaration("CursorManager");
  249.          var _loc2_:Class = _loc1_.getStyle("busyCursor");
  250.          busyCursorList.push(setCursor(_loc2_,CursorManagerPriority.LOW));
  251.       }
  252.       
  253.       private function findSource(param1:Object) : int
  254.       {
  255.          var _loc2_:int = int(sourceArray.length);
  256.          var _loc3_:int = 0;
  257.          while(_loc3_ < _loc2_)
  258.          {
  259.             if(sourceArray[_loc3_] === param1)
  260.             {
  261.                return _loc3_;
  262.             }
  263.             _loc3_++;
  264.          }
  265.          return -1;
  266.       }
  267.       
  268.       private function showCurrentCursor() : void
  269.       {
  270.          var _loc1_:CursorQueueItem = null;
  271.          var _loc2_:InterManagerRequest = null;
  272.          var _loc3_:Point = null;
  273.          if(cursorList.length > 0)
  274.          {
  275.             if(!initialized)
  276.             {
  277.                cursorHolder = new FlexSprite();
  278.                cursorHolder.name = "cursorHolder";
  279.                cursorHolder.mouseEnabled = false;
  280.                cursorHolder.mouseChildren = false;
  281.                systemManager.addChildToSandboxRoot("cursorChildren",cursorHolder);
  282.                initialized = true;
  283.                _loc2_ = new InterManagerRequest(InterManagerRequest.CURSOR_MANAGER_REQUEST);
  284.                _loc2_.name = "initialized";
  285.                sandboxRoot.dispatchEvent(_loc2_);
  286.             }
  287.             _loc1_ = cursorList[0];
  288.             if(currentCursorID == CursorManager.NO_CURSOR)
  289.             {
  290.                Mouse.hide();
  291.             }
  292.             if(_loc1_.cursorID != currentCursorID)
  293.             {
  294.                if(cursorHolder.numChildren > 0)
  295.                {
  296.                   cursorHolder.removeChildAt(0);
  297.                }
  298.                currentCursor = new _loc1_.cursorClass();
  299.                if(currentCursor)
  300.                {
  301.                   if(currentCursor is InteractiveObject)
  302.                   {
  303.                      InteractiveObject(currentCursor).mouseEnabled = false;
  304.                   }
  305.                   if(currentCursor is DisplayObjectContainer)
  306.                   {
  307.                      DisplayObjectContainer(currentCursor).mouseChildren = false;
  308.                   }
  309.                   cursorHolder.addChild(currentCursor);
  310.                   addContextMenuHandlers();
  311.                   if(systemManager is SystemManager)
  312.                   {
  313.                      _loc3_ = new Point(SystemManager(systemManager).mouseX + _loc1_.x,SystemManager(systemManager).mouseY + _loc1_.y);
  314.                      _loc3_ = SystemManager(systemManager).localToGlobal(_loc3_);
  315.                      _loc3_ = cursorHolder.parent.globalToLocal(_loc3_);
  316.                      cursorHolder.x = _loc3_.x;
  317.                      cursorHolder.y = _loc3_.y;
  318.                   }
  319.                   else if(systemManager is DisplayObject)
  320.                   {
  321.                      _loc3_ = new Point(DisplayObject(systemManager).mouseX + _loc1_.x,DisplayObject(systemManager).mouseY + _loc1_.y);
  322.                      _loc3_ = DisplayObject(systemManager).localToGlobal(_loc3_);
  323.                      _loc3_ = cursorHolder.parent.globalToLocal(_loc3_);
  324.                      cursorHolder.x = DisplayObject(systemManager).mouseX + _loc1_.x;
  325.                      cursorHolder.y = DisplayObject(systemManager).mouseY + _loc1_.y;
  326.                   }
  327.                   else
  328.                   {
  329.                      cursorHolder.x = _loc1_.x;
  330.                      cursorHolder.y = _loc1_.y;
  331.                   }
  332.                   if(systemManager.useSWFBridge())
  333.                   {
  334.                      sandboxRoot.addEventListener(MouseEvent.MOUSE_MOVE,mouseMoveHandler,true,EventPriority.CURSOR_MANAGEMENT);
  335.                   }
  336.                   else
  337.                   {
  338.                      systemManager.stage.addEventListener(MouseEvent.MOUSE_MOVE,mouseMoveHandler,true,EventPriority.CURSOR_MANAGEMENT);
  339.                   }
  340.                   sandboxRoot.addEventListener(SandboxMouseEvent.MOUSE_MOVE_SOMEWHERE,marshalMouseMoveHandler,false,EventPriority.CURSOR_MANAGEMENT);
  341.                   if(systemManager.useSWFBridge())
  342.                   {
  343.                      sandboxRoot.addEventListener(MouseEvent.MOUSE_OUT,mouseOutHandler,true,EventPriority.CURSOR_MANAGEMENT);
  344.                   }
  345.                   else
  346.                   {
  347.                      systemManager.stage.addEventListener(MouseEvent.MOUSE_OUT,mouseOutHandler,true,EventPriority.CURSOR_MANAGEMENT);
  348.                   }
  349.                }
  350.                currentCursorID = _loc1_.cursorID;
  351.                currentCursorXOffset = _loc1_.x;
  352.                currentCursorYOffset = _loc1_.y;
  353.             }
  354.          }
  355.          else
  356.          {
  357.             showCustomCursor = false;
  358.             if(currentCursorID != CursorManager.NO_CURSOR)
  359.             {
  360.                currentCursorID = CursorManager.NO_CURSOR;
  361.                currentCursorXOffset = 0;
  362.                currentCursorYOffset = 0;
  363.                cursorHolder.removeChild(currentCursor);
  364.                removeSystemManagerHandlers();
  365.                removeContextMenuHandlers();
  366.             }
  367.             Mouse.show();
  368.          }
  369.       }
  370.       
  371.       public function get currentCursorYOffset() : Number
  372.       {
  373.          return _currentCursorYOffset;
  374.       }
  375.       
  376.       private function contextMenu_menuSelectHandler(param1:ContextMenuEvent) : void
  377.       {
  378.          showCustomCursor = true;
  379.          sandboxRoot.addEventListener(MouseEvent.MOUSE_OVER,mouseOverHandler);
  380.       }
  381.       
  382.       public function hideCursor() : void
  383.       {
  384.          var _loc1_:InterManagerRequest = null;
  385.          if(cursorHolder)
  386.          {
  387.             cursorHolder.visible = false;
  388.          }
  389.          else
  390.          {
  391.             _loc1_ = new InterManagerRequest(InterManagerRequest.CURSOR_MANAGER_REQUEST);
  392.             _loc1_.name = "hideCursor";
  393.             sandboxRoot.dispatchEvent(_loc1_);
  394.          }
  395.       }
  396.       
  397.       public function showCursor() : void
  398.       {
  399.          var _loc1_:InterManagerRequest = null;
  400.          if(cursorHolder)
  401.          {
  402.             cursorHolder.visible = true;
  403.          }
  404.          else
  405.          {
  406.             _loc1_ = new InterManagerRequest(InterManagerRequest.CURSOR_MANAGER_REQUEST);
  407.             _loc1_.name = "showCursor";
  408.             sandboxRoot.dispatchEvent(_loc1_);
  409.          }
  410.       }
  411.       
  412.       private function marshalCursorManagerHandler(param1:Event) : void
  413.       {
  414.          var _loc3_:InterManagerRequest = null;
  415.          if(param1 is InterManagerRequest)
  416.          {
  417.             return;
  418.          }
  419.          var _loc2_:Object = param1;
  420.          switch(_loc2_.name)
  421.          {
  422.             case "initialized":
  423.                initialized = _loc2_.value;
  424.                break;
  425.             case "currentCursorID":
  426.                _currentCursorID = _loc2_.value;
  427.                break;
  428.             case "currentCursorXOffset":
  429.                _currentCursorXOffset = _loc2_.value;
  430.                break;
  431.             case "currentCursorYOffset":
  432.                _currentCursorYOffset = _loc2_.value;
  433.                break;
  434.             case "showCursor":
  435.                if(cursorHolder)
  436.                {
  437.                   cursorHolder.visible = true;
  438.                }
  439.                break;
  440.             case "hideCursor":
  441.                if(cursorHolder)
  442.                {
  443.                   cursorHolder.visible = false;
  444.                }
  445.                break;
  446.             case "setCursor":
  447.                if(cursorHolder)
  448.                {
  449.                   _loc2_.value = setCursor.apply(this,_loc2_.value);
  450.                }
  451.                break;
  452.             case "removeCursor":
  453.                if(cursorHolder)
  454.                {
  455.                   removeCursor.apply(this,[_loc2_.value]);
  456.                }
  457.                break;
  458.             case "removeAllCursors":
  459.                if(cursorHolder)
  460.                {
  461.                   removeAllCursors();
  462.                }
  463.                break;
  464.             case "setBusyCursor":
  465.                if(cursorHolder)
  466.                {
  467.                   setBusyCursor();
  468.                }
  469.                break;
  470.             case "removeBusyCursor":
  471.                if(cursorHolder)
  472.                {
  473.                   removeBusyCursor();
  474.                }
  475.                break;
  476.             case "registerToUseBusyCursor":
  477.                if(cursorHolder)
  478.                {
  479.                   registerToUseBusyCursor.apply(this,_loc2_.value);
  480.                }
  481.                break;
  482.             case "unRegisterToUseBusyCursor":
  483.                if(cursorHolder)
  484.                {
  485.                   unRegisterToUseBusyCursor.apply(this,_loc2_.value);
  486.                }
  487.                break;
  488.             case "update":
  489.                if(cursorHolder)
  490.                {
  491.                   _loc3_ = new InterManagerRequest(InterManagerRequest.CURSOR_MANAGER_REQUEST);
  492.                   _loc3_.name = "initialized";
  493.                   _loc3_.value = true;
  494.                   sandboxRoot.dispatchEvent(_loc3_);
  495.                   _loc3_ = new InterManagerRequest(InterManagerRequest.CURSOR_MANAGER_REQUEST);
  496.                   _loc3_.name = "currentCursorID";
  497.                   _loc3_.value = currentCursorID;
  498.                   sandboxRoot.dispatchEvent(_loc3_);
  499.                   _loc3_ = new InterManagerRequest(InterManagerRequest.CURSOR_MANAGER_REQUEST);
  500.                   _loc3_.name = "currentCursorXOffset";
  501.                   _loc3_.value = currentCursorXOffset;
  502.                   sandboxRoot.dispatchEvent(_loc3_);
  503.                   _loc3_ = new InterManagerRequest(InterManagerRequest.CURSOR_MANAGER_REQUEST);
  504.                   _loc3_.name = "currentCursorYOffset";
  505.                   _loc3_.value = currentCursorYOffset;
  506.                   sandboxRoot.dispatchEvent(_loc3_);
  507.                }
  508.          }
  509.       }
  510.       
  511.       public function removeAllCursors() : void
  512.       {
  513.          var _loc1_:InterManagerRequest = null;
  514.          if(initialized && !cursorHolder)
  515.          {
  516.             _loc1_ = new InterManagerRequest(InterManagerRequest.CURSOR_MANAGER_REQUEST);
  517.             _loc1_.name = "removeAllCursors";
  518.             sandboxRoot.dispatchEvent(_loc1_);
  519.             return;
  520.          }
  521.          cursorList.splice(0);
  522.          showCurrentCursor();
  523.       }
  524.       
  525.       private function completeHandler(param1:Event) : void
  526.       {
  527.          var _loc2_:int = findSource(param1.target);
  528.          if(_loc2_ != -1)
  529.          {
  530.             sourceArray.splice(_loc2_,1);
  531.             removeBusyCursor();
  532.          }
  533.       }
  534.       
  535.       public function removeBusyCursor() : void
  536.       {
  537.          var _loc1_:InterManagerRequest = null;
  538.          if(initialized && !cursorHolder)
  539.          {
  540.             _loc1_ = new InterManagerRequest(InterManagerRequest.CURSOR_MANAGER_REQUEST);
  541.             _loc1_.name = "removeBusyCursor";
  542.             sandboxRoot.dispatchEvent(_loc1_);
  543.             return;
  544.          }
  545.          if(busyCursorList.length > 0)
  546.          {
  547.             removeCursor(int(busyCursorList.pop()));
  548.          }
  549.       }
  550.       
  551.       private function addContextMenuHandlers() : void
  552.       {
  553.          var _loc1_:InteractiveObject = null;
  554.          var _loc2_:InteractiveObject = null;
  555.          if(!listenForContextMenu)
  556.          {
  557.             _loc1_ = systemManager.document as InteractiveObject;
  558.             _loc2_ = systemManager as InteractiveObject;
  559.             if(Boolean(_loc1_) && Boolean(_loc1_.contextMenu))
  560.             {
  561.                _loc1_.contextMenu.addEventListener(ContextMenuEvent.MENU_SELECT,contextMenu_menuSelectHandler,true,EventPriority.CURSOR_MANAGEMENT);
  562.                listenForContextMenu = true;
  563.             }
  564.             if(Boolean(_loc2_) && Boolean(_loc2_.contextMenu))
  565.             {
  566.                _loc2_.contextMenu.addEventListener(ContextMenuEvent.MENU_SELECT,contextMenu_menuSelectHandler,true,EventPriority.CURSOR_MANAGEMENT);
  567.                listenForContextMenu = true;
  568.             }
  569.          }
  570.       }
  571.       
  572.       public function setCursor(param1:Class, param2:int = 2, param3:Number = 0, param4:Number = 0) : int
  573.       {
  574.          var _loc7_:InterManagerRequest = null;
  575.          if(initialized && !cursorHolder)
  576.          {
  577.             _loc7_ = new InterManagerRequest(InterManagerRequest.CURSOR_MANAGER_REQUEST);
  578.             _loc7_.name = "setCursor";
  579.             _loc7_.value = [param1,param2,param3,param4];
  580.             sandboxRoot.dispatchEvent(_loc7_);
  581.             return _loc7_.value as int;
  582.          }
  583.          var _loc5_:int = int(nextCursorID++);
  584.          var _loc6_:CursorQueueItem = new CursorQueueItem();
  585.          _loc6_.cursorID = _loc5_;
  586.          _loc6_.cursorClass = param1;
  587.          _loc6_.priority = param2;
  588.          _loc6_.x = param3;
  589.          _loc6_.y = param4;
  590.          if(systemManager)
  591.          {
  592.             _loc6_.systemManager = systemManager;
  593.          }
  594.          else
  595.          {
  596.             _loc6_.systemManager = ApplicationGlobals.application.systemManager;
  597.          }
  598.          cursorList.push(_loc6_);
  599.          cursorList.sort(priorityCompare);
  600.          showCurrentCursor();
  601.          return _loc5_;
  602.       }
  603.       
  604.       private function progressHandler(param1:ProgressEvent) : void
  605.       {
  606.          var _loc2_:int = findSource(param1.target);
  607.          if(_loc2_ == -1)
  608.          {
  609.             sourceArray.push(param1.target);
  610.             setBusyCursor();
  611.          }
  612.       }
  613.       
  614.       private function removeSystemManagerHandlers() : void
  615.       {
  616.          if(systemManager.useSWFBridge())
  617.          {
  618.             sandboxRoot.removeEventListener(MouseEvent.MOUSE_MOVE,mouseMoveHandler,true);
  619.          }
  620.          else
  621.          {
  622.             systemManager.stage.removeEventListener(MouseEvent.MOUSE_MOVE,mouseMoveHandler,true);
  623.          }
  624.          sandboxRoot.removeEventListener(SandboxMouseEvent.MOUSE_MOVE_SOMEWHERE,marshalMouseMoveHandler,false);
  625.          if(systemManager.useSWFBridge())
  626.          {
  627.             sandboxRoot.removeEventListener(MouseEvent.MOUSE_OUT,mouseMoveHandler,true);
  628.          }
  629.          else
  630.          {
  631.             systemManager.stage.removeEventListener(MouseEvent.MOUSE_OUT,mouseOutHandler,true);
  632.          }
  633.       }
  634.       
  635.       public function registerToUseBusyCursor(param1:Object) : void
  636.       {
  637.          var _loc2_:InterManagerRequest = null;
  638.          if(initialized && !cursorHolder)
  639.          {
  640.             _loc2_ = new InterManagerRequest(InterManagerRequest.CURSOR_MANAGER_REQUEST);
  641.             _loc2_.name = "registerToUseBusyCursor";
  642.             _loc2_.value = param1;
  643.             sandboxRoot.dispatchEvent(_loc2_);
  644.             return;
  645.          }
  646.          if(Boolean(param1) && param1 is EventDispatcher)
  647.          {
  648.             param1.addEventListener(ProgressEvent.PROGRESS,progressHandler);
  649.             param1.addEventListener(Event.COMPLETE,completeHandler);
  650.             param1.addEventListener(IOErrorEvent.IO_ERROR,completeHandler);
  651.          }
  652.       }
  653.       
  654.       private function mouseMoveHandler(param1:MouseEvent) : void
  655.       {
  656.          var _loc4_:SWFBridgeRequest = null;
  657.          var _loc5_:IEventDispatcher = null;
  658.          var _loc2_:Point = new Point(param1.stageX,param1.stageY);
  659.          _loc2_ = cursorHolder.parent.globalToLocal(_loc2_);
  660.          _loc2_.x += currentCursorXOffset;
  661.          _loc2_.y += currentCursorYOffset;
  662.          cursorHolder.x = _loc2_.x;
  663.          cursorHolder.y = _loc2_.y;
  664.          var _loc3_:Object = param1.target;
  665.          if(!overTextField && _loc3_ is TextField && _loc3_.type == TextFieldType.INPUT)
  666.          {
  667.             overTextField = true;
  668.             showSystemCursor = true;
  669.          }
  670.          else if(overTextField && !(_loc3_ is TextField && _loc3_.type == TextFieldType.INPUT))
  671.          {
  672.             overTextField = false;
  673.             showCustomCursor = true;
  674.          }
  675.          else
  676.          {
  677.             showCustomCursor = true;
  678.          }
  679.          if(showSystemCursor)
  680.          {
  681.             showSystemCursor = false;
  682.             cursorHolder.visible = false;
  683.             Mouse.show();
  684.          }
  685.          if(showCustomCursor)
  686.          {
  687.             showCustomCursor = false;
  688.             cursorHolder.visible = true;
  689.             Mouse.hide();
  690.             _loc4_ = new SWFBridgeRequest(SWFBridgeRequest.HIDE_MOUSE_CURSOR_REQUEST);
  691.             if(systemManager.useSWFBridge())
  692.             {
  693.                _loc5_ = systemManager.swfBridgeGroup.parentBridge;
  694.             }
  695.             else
  696.             {
  697.                _loc5_ = systemManager;
  698.             }
  699.             _loc4_.requestor = _loc5_;
  700.             _loc5_.dispatchEvent(_loc4_);
  701.          }
  702.       }
  703.       
  704.       public function unRegisterToUseBusyCursor(param1:Object) : void
  705.       {
  706.          var _loc2_:InterManagerRequest = null;
  707.          if(initialized && !cursorHolder)
  708.          {
  709.             _loc2_ = new InterManagerRequest(InterManagerRequest.CURSOR_MANAGER_REQUEST);
  710.             _loc2_.name = "unRegisterToUseBusyCursor";
  711.             _loc2_.value = param1;
  712.             sandboxRoot.dispatchEvent(_loc2_);
  713.             return;
  714.          }
  715.          if(Boolean(param1) && param1 is EventDispatcher)
  716.          {
  717.             param1.removeEventListener(ProgressEvent.PROGRESS,progressHandler);
  718.             param1.removeEventListener(Event.COMPLETE,completeHandler);
  719.             param1.removeEventListener(IOErrorEvent.IO_ERROR,completeHandler);
  720.          }
  721.       }
  722.       
  723.       public function set currentCursorXOffset(param1:Number) : void
  724.       {
  725.          var _loc2_:InterManagerRequest = null;
  726.          _currentCursorXOffset = param1;
  727.          if(!cursorHolder)
  728.          {
  729.             _loc2_ = new InterManagerRequest(InterManagerRequest.CURSOR_MANAGER_REQUEST);
  730.             _loc2_.name = "currentCursorXOffset";
  731.             _loc2_.value = currentCursorXOffset;
  732.             sandboxRoot.dispatchEvent(_loc2_);
  733.          }
  734.       }
  735.    }
  736. }
  737.  
  738. import mx.core.mx_internal;
  739.  
  740. use namespace mx_internal;
  741.  
  742. class CursorQueueItem
  743. {
  744.    mx_internal static const VERSION:String = "3.5.0.12683";
  745.    
  746.    public var priority:int = 2;
  747.    
  748.    public var cursorClass:Class = null;
  749.    
  750.    public var cursorID:int = 0;
  751.    
  752.    public var x:Number;
  753.    
  754.    public var y:Number;
  755.    
  756.    public var systemManager:ISystemManager;
  757.    
  758.    public function CursorQueueItem()
  759.    {
  760.       super();
  761.    }
  762. }
  763.