home *** CD-ROM | disk | FTP | other *** search
/ Hentai Interactivo 69 / HENTAI69.bin / flip1.swf / scripts / __Packages / mx / managers / FocusManager.as < prev    next >
Text File  |  2009-07-27  |  22KB  |  692 lines

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