home *** CD-ROM | disk | FTP | other *** search
/ Hentai Interactivo 64 / HENTAI64.bin / flip1.swf / scripts / __Packages / mx / skins / halo / FocusRect.as < prev    next >
Text File  |  2009-05-08  |  4KB  |  140 lines

  1. class mx.skins.halo.FocusRect extends mx.skins.SkinElement
  2. {
  3.    static var classConstructed = mx.skins.halo.FocusRect.classConstruct();
  4.    static var DefaultsDependency = mx.skins.halo.Defaults;
  5.    static var UIComponentDependency = mx.core.UIComponent;
  6.    function FocusRect()
  7.    {
  8.       super();
  9.       this.boundingBox_mc._visible = false;
  10.       this.boundingBox_mc._width = this.boundingBox_mc._height = 0;
  11.    }
  12.    function draw(o)
  13.    {
  14.       o.adjustFocusRect();
  15.    }
  16.    function setSize(w, h, r, a, rectCol)
  17.    {
  18.       this._xscale = this._yscale = 100;
  19.       this.clear();
  20.       if(typeof r == "object")
  21.       {
  22.          r.br = r.br <= 2 ? 0 : r.br - 2;
  23.          r.bl = r.bl <= 2 ? 0 : r.bl - 2;
  24.          r.tr = r.tr <= 2 ? 0 : r.tr - 2;
  25.          r.tl = r.tl <= 2 ? 0 : r.tl - 2;
  26.          this.beginFill(rectCol,a * 0.3);
  27.          this.drawRoundRect(0,0,w,h,r);
  28.          this.drawRoundRect(2,2,w - 4,h - 4,r);
  29.          this.endFill();
  30.          r.br = r.br <= 1 ? 0 : r.br + 1;
  31.          r.bl = r.bl <= 1 ? 0 : r.bl + 1;
  32.          r.tr = r.tr <= 1 ? 0 : r.tr + 1;
  33.          r.tl = r.tl <= 1 ? 0 : r.tl + 1;
  34.          this.beginFill(rectCol,a * 0.3);
  35.          this.drawRoundRect(1,1,w - 2,h - 2,r);
  36.          r.br = r.br <= 1 ? 0 : r.br - 1;
  37.          r.bl = r.bl <= 1 ? 0 : r.bl - 1;
  38.          r.tr = r.tr <= 1 ? 0 : r.tr - 1;
  39.          r.tl = r.tl <= 1 ? 0 : r.tl - 1;
  40.          this.drawRoundRect(2,2,w - 4,h - 4,r);
  41.          this.endFill();
  42.       }
  43.       else
  44.       {
  45.          var _loc5_ = undefined;
  46.          if(r != 0)
  47.          {
  48.             _loc5_ = r - 2;
  49.          }
  50.          else
  51.          {
  52.             _loc5_ = 0;
  53.          }
  54.          this.beginFill(rectCol,a * 0.3);
  55.          this.drawRoundRect(0,0,w,h,r);
  56.          this.drawRoundRect(2,2,w - 4,h - 4,_loc5_);
  57.          this.endFill();
  58.          this.beginFill(rectCol,a * 0.3);
  59.          if(r != 0)
  60.          {
  61.             _loc5_ = r - 2;
  62.             r -= 1;
  63.          }
  64.          else
  65.          {
  66.             _loc5_ = 0;
  67.             r = 0;
  68.          }
  69.          this.drawRoundRect(1,1,w - 2,h - 2,r);
  70.          this.drawRoundRect(2,2,w - 4,h - 4,_loc5_);
  71.          this.endFill();
  72.       }
  73.    }
  74.    function handleEvent(e)
  75.    {
  76.       if(e.type == "unload")
  77.       {
  78.          this._visible = true;
  79.       }
  80.       else if(e.type == "resize")
  81.       {
  82.          e.target.adjustFocusRect();
  83.       }
  84.       else if(e.type == "move")
  85.       {
  86.          e.target.adjustFocusRect();
  87.       }
  88.    }
  89.    static function classConstruct()
  90.    {
  91.       mx.core.UIComponent.prototype.drawFocus = function(focused)
  92.       {
  93.          var _loc2_ = this._parent.focus_mc;
  94.          if(!focused)
  95.          {
  96.             _loc2_._visible = false;
  97.             this.removeEventListener("unload",_loc2_);
  98.             this.removeEventListener("move",_loc2_);
  99.             this.removeEventListener("resize",_loc2_);
  100.          }
  101.          else
  102.          {
  103.             if(_loc2_ == undefined)
  104.             {
  105.                _loc2_ = this._parent.createChildAtDepth("FocusRect",mx.managers.DepthManager.kTop);
  106.                _loc2_.tabEnabled = false;
  107.                this._parent.focus_mc = _loc2_;
  108.             }
  109.             else
  110.             {
  111.                _loc2_._visible = true;
  112.             }
  113.             _loc2_.draw(this);
  114.             if(_loc2_.getDepth() < this.getDepth())
  115.             {
  116.                _loc2_.setDepthAbove(this);
  117.             }
  118.             this.addEventListener("unload",_loc2_);
  119.             this.addEventListener("move",_loc2_);
  120.             this.addEventListener("resize",_loc2_);
  121.          }
  122.       };
  123.       mx.core.UIComponent.prototype.adjustFocusRect = function()
  124.       {
  125.          var _loc2_ = this.getStyle("themeColor");
  126.          if(_loc2_ == undefined)
  127.          {
  128.             _loc2_ = 8453965;
  129.          }
  130.          var _loc3_ = this._parent.focus_mc;
  131.          _loc3_.setSize(this.width + 4,this.height + 4,0,100,_loc2_);
  132.          _loc3_.move(this.x - 2,this.y - 2);
  133.       };
  134.       TextField.prototype.drawFocus = mx.core.UIComponent.prototype.drawFocus;
  135.       TextField.prototype.adjustFocusRect = mx.core.UIComponent.prototype.adjustFocusRect;
  136.       mx.skins.halo.FocusRect.prototype.drawRoundRect = mx.skins.halo.Defaults.prototype.drawRoundRect;
  137.       return true;
  138.    }
  139. }
  140.