home *** CD-ROM | disk | FTP | other *** search
/ Canadian Forces / CF_FC.iso / pc / data / swf / Navy.swf / scripts / __Packages / mx / managers / FocusManager.as < prev    next >
Encoding:
Text File  |  2005-02-09  |  21.6 KB  |  710 lines

  1. class mx.managers.FocusManager extends mx.core.UIComponent
  2. {
  3.    var __defaultPushButton;
  4.    var defPushButton;
  5.    var form;
  6.    var tabCapture;
  7.    var lastFocus;
  8.    var lastSelFocus;
  9.    var _searchKey;
  10.    var _lastTarget;
  11.    var _firstNode;
  12.    var _nextIsNext;
  13.    var _nextNode;
  14.    var _lastx;
  15.    var _prevNode;
  16.    var _needPrev;
  17.    var _foundList;
  18.    var _prevObj;
  19.    var _nextObj;
  20.    var _firstObj;
  21.    var _lastObj;
  22.    var _lastNode;
  23.    var lastTabFocus;
  24.    var lastXMouse;
  25.    var lastYMouse;
  26.    static var symbolName = "FocusManager";
  27.    static var symbolOwner = mx.managers.FocusManager;
  28.    static var version = "2.0.0.360";
  29.    var className = "FocusManager";
  30.    var bNeedFocus = false;
  31.    var bDrawFocus = false;
  32.    var defaultPushButtonEnabled = true;
  33.    var activated = true;
  34.    static var initialized = false;
  35.    static var UIObjectExtensionsDependency = mx.core.ext.UIObjectExtensions;
  36.    function FocusManager()
  37.    {
  38.       super();
  39.    }
  40.    function get defaultPushButton()
  41.    {
  42.       return this.__defaultPushButton;
  43.    }
  44.    function set defaultPushButton(x)
  45.    {
  46.       if(x != this.__defaultPushButton)
  47.       {
  48.          this.__defaultPushButton.emphasized = false;
  49.          this.__defaultPushButton = x;
  50.          this.defPushButton = x;
  51.          x.emphasized = true;
  52.       }
  53.    }
  54.    function getMaxTabIndex(o)
  55.    {
  56.       var _loc3_ = 0;
  57.       var _loc6_ = undefined;
  58.       for(_loc6_ in o)
  59.       {
  60.          var _loc2_ = o[_loc6_];
  61.          if(_loc2_._parent == o)
  62.          {
  63.             if(_loc2_.tabIndex != undefined)
  64.             {
  65.                if(_loc2_.tabIndex > _loc3_)
  66.                {
  67.                   _loc3_ = _loc2_.tabIndex;
  68.                }
  69.             }
  70.             if(_loc2_.tabChildren == true)
  71.             {
  72.                var _loc4_ = this.getMaxTabIndex(_loc2_);
  73.                if(_loc4_ > _loc3_)
  74.                {
  75.                   _loc3_ = _loc4_;
  76.                }
  77.             }
  78.          }
  79.       }
  80.       return _loc3_;
  81.    }
  82.    function getNextTabIndex(Void)
  83.    {
  84.       return this.getMaxTabIndex(this.form) + 1;
  85.    }
  86.    function get nextTabIndex()
  87.    {
  88.       return this.getNextTabIndex();
  89.    }
  90.    function relocate(Void)
  91.    {
  92.       var _loc2_ = mx.managers.SystemManager.screen;
  93.       this.move(_loc2_.x - 1,_loc2_.y - 1);
  94.    }
  95.    function init(Void)
  96.    {
  97.       super.init();
  98.       this.tabEnabled = false;
  99.       this._width = this._height = 1;
  100.       this._x = this._y = -1;
  101.       this._alpha = 0;
  102.       this._parent.focusManager = this;
  103.       this._parent.tabChildren = true;
  104.       this._parent.tabEnabled = false;
  105.       this.form = this._parent;
  106.       this._parent.addEventListener("hide",this);
  107.       this._parent.addEventListener("reveal",this);
  108.       mx.managers.SystemManager.init();
  109.       mx.managers.SystemManager.addFocusManager(this.form);
  110.       this.tabCapture.tabIndex = 0;
  111.       this.watch("enabled",this.enabledChanged);
  112.       Selection.addListener(this);
  113.    }
  114.    function enabledChanged(id, oldValue, newValue)
  115.    {
  116.       this._visible = newValue;
  117.       return newValue;
  118.    }
  119.    function activate(Void)
  120.    {
  121.       Key.addListener(this);
  122.       this.activated = this._visible = true;
  123.       if(this.lastFocus != undefined)
  124.       {
  125.          this.bNeedFocus = true;
  126.          if(!mx.managers.SystemManager.isMouseDown)
  127.          {
  128.             this.doLater(this,"restoreFocus");
  129.          }
  130.       }
  131.    }
  132.    function deactivate(Void)
  133.    {
  134.       Key.removeListener(this);
  135.       this.activated = this._visible = false;
  136.       var _loc2_ = this.getSelectionFocus();
  137.       var _loc3_ = this.getActualFocus(_loc2_);
  138.       if(this.isOurFocus(_loc3_))
  139.       {
  140.          this.lastSelFocus = _loc2_;
  141.          this.lastFocus = _loc3_;
  142.       }
  143.       this.cancelAllDoLaters();
  144.    }
  145.    function isOurFocus(o)
  146.    {
  147.       if(o.focusManager == this)
  148.       {
  149.          return true;
  150.       }
  151.       while(o != undefined)
  152.       {
  153.          if(o.focusManager != undefined)
  154.          {
  155.             return false;
  156.          }
  157.          if(o._parent == this._parent)
  158.          {
  159.             return true;
  160.          }
  161.          o = o._parent;
  162.       }
  163.       return false;
  164.    }
  165.    function onSetFocus(o, n)
  166.    {
  167.       if(n == null)
  168.       {
  169.          if(this.activated)
  170.          {
  171.             this.bNeedFocus = true;
  172.          }
  173.       }
  174.       else
  175.       {
  176.          var _loc2_ = this.getFocus();
  177.          if(this.isOurFocus(_loc2_))
  178.          {
  179.             this.bNeedFocus = false;
  180.             this.lastFocus = _loc2_;
  181.             this.lastSelFocus = n;
  182.          }
  183.       }
  184.    }
  185.    function restoreFocus(Void)
  186.    {
  187.       var _loc2_ = this.lastSelFocus.hscroll;
  188.       if(_loc2_ != undefined)
  189.       {
  190.          var _loc5_ = this.lastSelFocus.scroll;
  191.          var _loc4_ = this.lastSelFocus.background;
  192.       }
  193.       this.lastFocus.setFocus();
  194.       var _loc3_ = Selection;
  195.       Selection.setSelection(_loc3_.lastBeginIndex,_loc3_.lastEndIndex);
  196.       if(_loc2_ != undefined)
  197.       {
  198.          this.lastSelFocus.scroll = _loc5_;
  199.          this.lastSelFocus.hscroll = _loc2_;
  200.          this.lastSelFocus.background = _loc4_;
  201.       }
  202.    }
  203.    function onUnload(Void)
  204.    {
  205.       mx.managers.SystemManager.removeFocusManager(this.form);
  206.    }
  207.    function setFocus(o)
  208.    {
  209.       if(o == null)
  210.       {
  211.          Selection.setFocus(null);
  212.       }
  213.       else if(o.setFocus == undefined)
  214.       {
  215.          Selection.setFocus(o);
  216.       }
  217.       else
  218.       {
  219.          o.setFocus();
  220.       }
  221.    }
  222.    function getActualFocus(o)
  223.    {
  224.       var _loc1_ = o._parent;
  225.       while(_loc1_ != undefined)
  226.       {
  227.          if(_loc1_.focusTextField != undefined)
  228.          {
  229.             while(_loc1_.focusTextField != undefined)
  230.             {
  231.                o = _loc1_;
  232.                _loc1_ = _loc1_._parent;
  233.                if(_loc1_ == undefined)
  234.                {
  235.                   return undefined;
  236.                }
  237.                if(_loc1_.focusTextField == undefined)
  238.                {
  239.                   return o;
  240.                }
  241.             }
  242.          }
  243.          if(_loc1_.tabEnabled != true)
  244.          {
  245.             return o;
  246.          }
  247.          o = _loc1_;
  248.          _loc1_ = o._parent;
  249.       }
  250.       return undefined;
  251.    }
  252.    function getSelectionFocus()
  253.    {
  254.       var m = Selection.getFocus();
  255.       var o = eval(m);
  256.       return o;
  257.    }
  258.    function getFocus(Void)
  259.    {
  260.       var _loc2_ = this.getSelectionFocus();
  261.       return this.getActualFocus(_loc2_);
  262.    }
  263.    function walkTree(p, index, groupName, dir, lookup, firstChild)
  264.    {
  265.       var _loc5_ = true;
  266.       var _loc11_ = undefined;
  267.       for(_loc11_ in p)
  268.       {
  269.          var _loc2_ = p[_loc11_];
  270.          if(_loc2_._parent == p && _loc2_.enabled != false && _loc2_._visible != false && (_loc2_.tabEnabled == true || _loc2_.tabEnabled != false && (_loc2_.onPress != undefined || _loc2_.onRelease != undefined || _loc2_.onReleaseOutside != undefined || _loc2_.onDragOut != undefined || _loc2_.onDragOver != undefined || _loc2_.onRollOver != undefined || _loc2_.onRollOut != undefined || _loc2_ instanceof TextField)))
  271.          {
  272.             if(_loc2_._searchKey == this._searchKey)
  273.             {
  274.                continue;
  275.             }
  276.             _loc2_._searchKey = this._searchKey;
  277.             if(_loc2_ != this._lastTarget)
  278.             {
  279.                if((_loc2_.groupName != undefined || groupName != undefined) && _loc2_.groupName == groupName)
  280.                {
  281.                   continue;
  282.                }
  283.                if(_loc2_ instanceof TextField && _loc2_.selectable == false)
  284.                {
  285.                   continue;
  286.                }
  287.                if(_loc5_ || _loc2_.groupName != undefined && _loc2_.groupName == this._firstNode.groupName && _loc2_.selected == true)
  288.                {
  289.                   if(firstChild)
  290.                   {
  291.                      this._firstNode = _loc2_;
  292.                      firstChild = false;
  293.                   }
  294.                }
  295.                if(this._nextIsNext == true)
  296.                {
  297.                   if(_loc2_.groupName != undefined && _loc2_.groupName == this._nextNode.groupName && _loc2_.selected == true || this._nextNode == undefined && (_loc2_.groupName == undefined || _loc2_.groupName != undefined && _loc2_.groupName != groupName))
  298.                   {
  299.                      this._nextNode = _loc2_;
  300.                   }
  301.                }
  302.                if(_loc2_.groupName == undefined || groupName != _loc2_.groupName)
  303.                {
  304.                   if(!(this._lastx.groupName != undefined && _loc2_.groupName == this._lastx.groupName && this._lastx.selected == true))
  305.                   {
  306.                      this._lastx = _loc2_;
  307.                   }
  308.                }
  309.             }
  310.             else
  311.             {
  312.                this._prevNode = this._lastx;
  313.                this._needPrev = false;
  314.                this._nextIsNext = true;
  315.             }
  316.             if(_loc2_.tabIndex != undefined)
  317.             {
  318.                if(_loc2_.tabIndex == index)
  319.                {
  320.                   if(this._foundList[_loc2_._name] == undefined)
  321.                   {
  322.                      if(this._needPrev)
  323.                      {
  324.                         this._prevObj = _loc2_;
  325.                         this._needPrev = false;
  326.                      }
  327.                      this._nextObj = _loc2_;
  328.                   }
  329.                }
  330.                if(dir && _loc2_.tabIndex > index)
  331.                {
  332.                   if(this._nextObj == undefined || this._nextObj.tabIndex > _loc2_.tabIndex && (_loc2_.groupName == undefined || this._nextObj.groupName == undefined || _loc2_.groupName != this._nextObj.groupName) || this._nextObj.groupName != undefined && this._nextObj.groupName == _loc2_.groupName && this._nextObj.selected != true && (_loc2_.selected == true || this._nextObj.tabIndex > _loc2_.tabIndex))
  333.                   {
  334.                      this._nextObj = _loc2_;
  335.                   }
  336.                }
  337.                else if(!dir && _loc2_.tabIndex < index)
  338.                {
  339.                   if(this._prevObj == undefined || this._prevObj.tabIndex < _loc2_.tabIndex && (_loc2_.groupName == undefined || this._prevObj.groupName == undefined || _loc2_.groupName != this._prevObj.groupName) || this._prevObj.groupName != undefined && this._prevObj.groupName == _loc2_.groupName && this._prevObj.selected != true && (_loc2_.selected == true || this._prevObj.tabIndex < _loc2_.tabIndex))
  340.                   {
  341.                      this._prevObj = _loc2_;
  342.                   }
  343.                }
  344.                if(this._firstObj == undefined || _loc2_.tabIndex < this._firstObj.tabIndex && (_loc2_.groupName == undefined || this._firstObj.groupName == undefined || _loc2_.groupName != this._firstObj.groupName) || this._firstObj.groupName != undefined && this._firstObj.groupName == _loc2_.groupName && this._firstObj.selected != true && (_loc2_.selected == true || _loc2_.tabIndex < this._firstObj.tabIndex))
  345.                {
  346.                   this._firstObj = _loc2_;
  347.                }
  348.                if(this._lastObj == undefined || _loc2_.tabIndex > this._lastObj.tabIndex && (_loc2_.groupName == undefined || this._lastObj.groupName == undefined || _loc2_.groupName != this._lastObj.groupName) || this._lastObj.groupName != undefined && this._lastObj.groupName == _loc2_.groupName && this._lastObj.selected != true && (_loc2_.selected == true || _loc2_.tabIndex > this._lastObj.tabIndex))
  349.                {
  350.                   this._lastObj = _loc2_;
  351.                }
  352.             }
  353.             if(_loc2_.tabChildren)
  354.             {
  355.                this.getTabCandidateFromChildren(_loc2_,index,groupName,dir,_loc5_ && firstChild);
  356.             }
  357.             _loc5_ = false;
  358.          }
  359.          else if(_loc2_._parent == p && _loc2_.tabChildren == true && _loc2_._visible != false)
  360.          {
  361.             if(_loc2_ == this._lastTarget)
  362.             {
  363.                if(_loc2_._searchKey == this._searchKey)
  364.                {
  365.                   continue;
  366.                }
  367.                _loc2_._searchKey = this._searchKey;
  368.                if(this._prevNode == undefined)
  369.                {
  370.                   var _loc3_ = this._lastx;
  371.                   var _loc7_ = false;
  372.                   while(_loc3_ != undefined)
  373.                   {
  374.                      if(_loc3_ == _loc2_)
  375.                      {
  376.                         _loc7_ = true;
  377.                         break;
  378.                      }
  379.                      _loc3_ = _loc3_._parent;
  380.                   }
  381.                   if(_loc7_ == false)
  382.                   {
  383.                      this._prevNode = this._lastx;
  384.                   }
  385.                }
  386.                this._needPrev = false;
  387.                if(this._nextNode == undefined)
  388.                {
  389.                   this._nextIsNext = true;
  390.                }
  391.             }
  392.             else if(!(_loc2_.focusManager != undefined && _loc2_.focusManager._parent == _loc2_))
  393.             {
  394.                if(_loc2_._searchKey == this._searchKey)
  395.                {
  396.                   continue;
  397.                }
  398.                _loc2_._searchKey = this._searchKey;
  399.                this.getTabCandidateFromChildren(_loc2_,index,groupName,dir,_loc5_ && firstChild);
  400.             }
  401.             _loc5_ = false;
  402.          }
  403.       }
  404.       this._lastNode = this._lastx;
  405.       if(lookup)
  406.       {
  407.          if(p._parent != undefined)
  408.          {
  409.             if(p != this._parent)
  410.             {
  411.                if(this._prevNode == undefined && dir)
  412.                {
  413.                   this._needPrev = true;
  414.                }
  415.                else if(this._nextNode == undefined && !dir)
  416.                {
  417.                   this._nextIsNext = false;
  418.                }
  419.                this._lastTarget = this._lastTarget._parent;
  420.                this.getTabCandidate(p._parent,index,groupName,dir,true);
  421.             }
  422.          }
  423.       }
  424.    }
  425.    function getTabCandidate(o, index, groupName, dir, firstChild)
  426.    {
  427.       var _loc2_ = undefined;
  428.       var _loc3_ = true;
  429.       if(o == this._parent)
  430.       {
  431.          _loc2_ = o;
  432.          _loc3_ = false;
  433.       }
  434.       else
  435.       {
  436.          _loc2_ = o._parent;
  437.          if(_loc2_ == undefined)
  438.          {
  439.             _loc2_ = o;
  440.             _loc3_ = false;
  441.          }
  442.       }
  443.       this.walkTree(_loc2_,index,groupName,dir,_loc3_,firstChild);
  444.    }
  445.    function getTabCandidateFromChildren(o, index, groupName, dir, firstChild)
  446.    {
  447.       this.walkTree(o,index,groupName,dir,false,firstChild);
  448.    }
  449.    function getFocusManagerFromObject(o)
  450.    {
  451.       while(o != undefined)
  452.       {
  453.          if(o.focusManager != undefined)
  454.          {
  455.             return o.focusManager;
  456.          }
  457.          o = o._parent;
  458.       }
  459.       return undefined;
  460.    }
  461.    function tabHandler(Void)
  462.    {
  463.       this.bDrawFocus = true;
  464.       var _loc5_ = this.getSelectionFocus();
  465.       var _loc4_ = this.getActualFocus(_loc5_);
  466.       if(_loc4_ != _loc5_)
  467.       {
  468.          _loc5_ = _loc4_;
  469.       }
  470.       if(this.getFocusManagerFromObject(_loc5_) != this)
  471.       {
  472.          _loc5_ == undefined;
  473.       }
  474.       if(_loc5_ == undefined)
  475.       {
  476.          _loc5_ = this.form;
  477.       }
  478.       else if(_loc5_.tabIndex != undefined)
  479.       {
  480.          if(this._foundList != undefined || this._foundList.tabIndex != _loc5_.tabIndex)
  481.          {
  482.             this._foundList = new Object();
  483.             this._foundList.tabIndex = _loc5_.tabIndex;
  484.          }
  485.          this._foundList[_loc5_._name] = _loc5_;
  486.       }
  487.       var _loc3_ = Key.isDown(16) != true;
  488.       this._searchKey = getTimer();
  489.       this._needPrev = true;
  490.       this._nextIsNext = false;
  491.       this._lastx = undefined;
  492.       this._firstNode = undefined;
  493.       this._lastNode = undefined;
  494.       this._nextNode = undefined;
  495.       this._prevNode = undefined;
  496.       this._firstObj = undefined;
  497.       this._lastObj = undefined;
  498.       this._nextObj = undefined;
  499.       this._prevObj = undefined;
  500.       this._lastTarget = _loc5_;
  501.       var _loc6_ = _loc5_;
  502.       this.getTabCandidate(_loc6_,_loc5_.tabIndex != undefined ? _loc5_.tabIndex : 0,_loc5_.groupName,_loc3_,true);
  503.       var _loc2_ = undefined;
  504.       if(_loc3_)
  505.       {
  506.          if(this._nextObj != undefined)
  507.          {
  508.             _loc2_ = this._nextObj;
  509.          }
  510.          else
  511.          {
  512.             _loc2_ = this._firstObj;
  513.          }
  514.       }
  515.       else if(this._prevObj != undefined)
  516.       {
  517.          _loc2_ = this._prevObj;
  518.       }
  519.       else
  520.       {
  521.          _loc2_ = this._lastObj;
  522.       }
  523.       if(_loc2_.tabIndex != _loc5_.tabIndex)
  524.       {
  525.          this._foundList = new Object();
  526.          this._foundList.tabIndex = _loc2_.tabIndex;
  527.          this._foundList[_loc2_._name] = _loc2_;
  528.       }
  529.       else
  530.       {
  531.          if(this._foundList == undefined)
  532.          {
  533.             this._foundList = new Object();
  534.             this._foundList.tabIndex = _loc2_.tabIndex;
  535.          }
  536.          this._foundList[_loc2_._name] = _loc2_;
  537.       }
  538.       if(_loc2_ == undefined)
  539.       {
  540.          if(_loc3_ == false)
  541.          {
  542.             if(this._nextNode != undefined)
  543.             {
  544.                _loc2_ = this._nextNode;
  545.             }
  546.             else
  547.             {
  548.                _loc2_ = this._firstNode;
  549.             }
  550.          }
  551.          else if(this._prevNode == undefined || _loc5_ == this.form)
  552.          {
  553.             _loc2_ = this._lastNode;
  554.          }
  555.          else
  556.          {
  557.             _loc2_ = this._prevNode;
  558.          }
  559.       }
  560.       if(_loc2_ == undefined)
  561.       {
  562.          return undefined;
  563.       }
  564.       this.lastTabFocus = _loc2_;
  565.       this.setFocus(_loc2_);
  566.       if(_loc2_.emphasized != undefined)
  567.       {
  568.          if(this.defPushButton != undefined)
  569.          {
  570.             _loc5_ = this.defPushButton;
  571.             this.defPushButton = _loc2_;
  572.             _loc5_.emphasized = false;
  573.             _loc2_.emphasized = true;
  574.          }
  575.       }
  576.       else if(this.defPushButton != undefined && this.defPushButton != this.__defaultPushButton)
  577.       {
  578.          _loc5_ = this.defPushButton;
  579.          this.defPushButton = this.__defaultPushButton;
  580.          _loc5_.emphasized = false;
  581.          this.__defaultPushButton.emphasized = true;
  582.       }
  583.    }
  584.    function onKeyDown(Void)
  585.    {
  586.       mx.managers.SystemManager.idleFrames = 0;
  587.       if(this.defaultPushButtonEnabled)
  588.       {
  589.          if(Key.getCode() == 13)
  590.          {
  591.             if(this.defaultPushButton != undefined)
  592.             {
  593.                this.doLater(this,"sendDefaultPushButtonEvent");
  594.             }
  595.          }
  596.       }
  597.    }
  598.    function sendDefaultPushButtonEvent(Void)
  599.    {
  600.       this.defPushButton.dispatchEvent({type:"click"});
  601.    }
  602.    function getMousedComponentFromChildren(x, y, o)
  603.    {
  604.       for(var _loc7_ in o)
  605.       {
  606.          var _loc2_ = o[_loc7_];
  607.          if(_loc2_._visible && _loc2_.enabled && _loc2_._parent == o && _loc2_._searchKey != this._searchKey)
  608.          {
  609.             _loc2_._searchKey = this._searchKey;
  610.             if(_loc2_.hitTest(x,y,true))
  611.             {
  612.                if(_loc2_.onPress != undefined || _loc2_.onRelease != undefined)
  613.                {
  614.                   return _loc2_;
  615.                }
  616.                var _loc3_ = this.getMousedComponentFromChildren(x,y,_loc2_);
  617.                if(_loc3_ != undefined)
  618.                {
  619.                   return _loc3_;
  620.                }
  621.                return _loc2_;
  622.             }
  623.          }
  624.       }
  625.       return undefined;
  626.    }
  627.    function mouseActivate(Void)
  628.    {
  629.       if(!this.bNeedFocus)
  630.       {
  631.          return undefined;
  632.       }
  633.       this._searchKey = getTimer();
  634.       var _loc2_ = this.getMousedComponentFromChildren(this.lastXMouse,this.lastYMouse,this.form);
  635.       if(_loc2_ instanceof mx.core.UIComponent)
  636.       {
  637.          return undefined;
  638.       }
  639.       _loc2_ = this.findFocusFromObject(_loc2_);
  640.       if(_loc2_ == this.lastFocus)
  641.       {
  642.          return undefined;
  643.       }
  644.       if(_loc2_ == undefined)
  645.       {
  646.          this.doLater(this,"restoreFocus");
  647.          return undefined;
  648.       }
  649.       var _loc3_ = _loc2_.hscroll;
  650.       if(_loc3_ != undefined)
  651.       {
  652.          var _loc6_ = _loc2_.scroll;
  653.          var _loc5_ = _loc2_.background;
  654.       }
  655.       this.setFocus(_loc2_);
  656.       var _loc4_ = Selection;
  657.       Selection.setSelection(_loc4_.lastBeginIndex,_loc4_.lastEndIndex);
  658.       if(_loc3_ != undefined)
  659.       {
  660.          _loc2_.scroll = _loc6_;
  661.          _loc2_.hscroll = _loc3_;
  662.          _loc2_.background = _loc5_;
  663.       }
  664.    }
  665.    function _onMouseDown(Void)
  666.    {
  667.       this.bDrawFocus = false;
  668.       if(this.lastFocus != undefined)
  669.       {
  670.          this.lastFocus.drawFocus(false);
  671.       }
  672.       mx.managers.SystemManager.idleFrames = 0;
  673.       var _loc3_ = Selection;
  674.       _loc3_.lastBeginIndex = Selection.getBeginIndex();
  675.       _loc3_.lastEndIndex = Selection.getEndIndex();
  676.       this.lastXMouse = _root._xmouse;
  677.       this.lastYMouse = _root._ymouse;
  678.    }
  679.    function onMouseUp(Void)
  680.    {
  681.       if(this._visible)
  682.       {
  683.          this.doLater(this,"mouseActivate");
  684.       }
  685.    }
  686.    function handleEvent(e)
  687.    {
  688.       if(e.type == "reveal")
  689.       {
  690.          mx.managers.SystemManager.activate(this.form);
  691.       }
  692.       else
  693.       {
  694.          mx.managers.SystemManager.deactivate(this.form);
  695.       }
  696.    }
  697.    static function enableFocusManagement()
  698.    {
  699.       if(!mx.managers.FocusManager.initialized)
  700.       {
  701.          mx.managers.FocusManager.initialized = true;
  702.          Object.registerClass("FocusManager",mx.managers.FocusManager);
  703.          if(_root.focusManager == undefined)
  704.          {
  705.             _root.createClassObject(mx.managers.FocusManager,"focusManager",mx.managers.DepthManager.highestDepth--);
  706.          }
  707.       }
  708.    }
  709. }
  710.