home *** CD-ROM | disk | FTP | other *** search
/ FCE Gold Plus / GOLD.iso / pc / main.swf / scripts / __Packages / mx / skins / sample / RectBorder.as < prev   
Encoding:
Text File  |  2007-11-02  |  4.6 KB  |  147 lines

  1. class mx.skins.sample.RectBorder extends mx.skins.RectBorder
  2. {
  3.    var offset;
  4.    var __borderMetrics;
  5.    var _color;
  6.    static var symbolName = "RectBorder";
  7.    static var symbolOwner = mx.skins.sample.RectBorder;
  8.    static var version = "2.0.2.126";
  9.    var colorList = {highlightColor:0,borderColor:0,buttonColor:0,shadowColor:0};
  10.    static var classConstructed = mx.skins.sample.RectBorder.classConstruct();
  11.    static var UIObjectExtensionsDependency = mx.core.ext.UIObjectExtensions;
  12.    function RectBorder()
  13.    {
  14.       super();
  15.    }
  16.    function init(Void)
  17.    {
  18.       super.init();
  19.    }
  20.    function getBorderMetrics(Void)
  21.    {
  22.       if(this.offset == undefined)
  23.       {
  24.          var _loc3_ = this.getStyle(this.borderStyleName);
  25.          this.offset = 0;
  26.          if(_loc3_ == "solid")
  27.          {
  28.             this.offset = 1;
  29.          }
  30.          else if(_loc3_ == "inset" || _loc3_ == "outset")
  31.          {
  32.             this.offset = 2;
  33.          }
  34.       }
  35.       if(this.getStyle(this.borderStyleName) == "menuBorder")
  36.       {
  37.          this.__borderMetrics = {left:1,top:1,right:2,bottom:1};
  38.          return this.__borderMetrics;
  39.       }
  40.       return super.getBorderMetrics();
  41.    }
  42.    function drawBorder(Void)
  43.    {
  44.       var _loc4_ = _global.styles[this.className];
  45.       if(_loc4_ == undefined)
  46.       {
  47.          _loc4_ = _global.styles.RectBorder;
  48.       }
  49.       var _loc3_ = this.getStyle(this.borderStyleName);
  50.       var _loc5_ = this.getStyle(this.borderColorName);
  51.       if(_loc5_ == undefined)
  52.       {
  53.          _loc5_ = _loc4_[this.borderColorName];
  54.       }
  55.       var _loc9_ = this.getStyle(this.backgroundColorName);
  56.       if(_loc9_ == undefined)
  57.       {
  58.          _loc9_ = _loc4_[this.backgroundColorName];
  59.       }
  60.       if(_loc3_ != "none")
  61.       {
  62.          var _loc7_ = this.getStyle(this.shadowColorName);
  63.          if(_loc7_ == undefined)
  64.          {
  65.             _loc7_ = _loc4_[this.shadowColorName];
  66.          }
  67.          var _loc6_ = this.getStyle(this.highlightColorName);
  68.          if(_loc6_ == undefined)
  69.          {
  70.             _loc6_ = _loc4_[this.highlightColorName];
  71.          }
  72.          var _loc10_ = this.getStyle(this.buttonColorName);
  73.          if(_loc10_ == undefined)
  74.          {
  75.             _loc10_ = _loc4_[this.buttonColorName];
  76.          }
  77.       }
  78.       this.offset = 0;
  79.       this.clear();
  80.       this._color = undefined;
  81.       if(_loc3_ != "none")
  82.       {
  83.          if(_loc3_ == "inset" || _loc3_ == "default" || _loc3_ == "alert" || _loc3_ == "falsedown")
  84.          {
  85.             this._color = this.colorList;
  86.             this.offset = 2;
  87.             this.draw3dBorder(_loc10_,_loc7_,_loc6_,_loc5_);
  88.          }
  89.          else if(_loc3_ == "outset" || _loc3_ == "falseup" || _loc3_ == "falseover")
  90.          {
  91.             this._color = this.colorList;
  92.             this.offset = 2;
  93.             this.draw3dBorder(_loc5_,_loc10_,_loc7_,_loc6_);
  94.          }
  95.          else if(_loc3_ == "truerollover" || _loc3_ == "truedown")
  96.          {
  97.             this._color = this.colorList;
  98.             this.offset = 2;
  99.             this.draw3dBorder(_loc10_,_loc7_,_loc6_,_loc5_);
  100.          }
  101.          else
  102.          {
  103.             var _loc11_ = this.width;
  104.             _loc10_ = this.height;
  105.             this.offset = 1;
  106.             this.beginFill(_loc5_);
  107.             this.drawRect(0,0,_loc11_,_loc10_);
  108.             this.drawRect(1,1,_loc11_ - 1,_loc10_ - 1);
  109.             this.endFill();
  110.             this._color = this.borderColorName;
  111.          }
  112.       }
  113.       var _loc8_ = this.offset;
  114.       this.beginFill(_loc9_);
  115.       this.drawRect(_loc8_,_loc8_,this.width - _loc8_,this.height - _loc8_);
  116.       this.endFill();
  117.    }
  118.    function draw3dBorder(c1, c2, c3, c4)
  119.    {
  120.       var _loc3_ = this.width;
  121.       var _loc2_ = this.height;
  122.       this.beginFill(c1);
  123.       this.drawRect(0,0,_loc3_,_loc2_);
  124.       this.drawRect(0,0,_loc3_ - 1,_loc2_ - 1);
  125.       this.endFill();
  126.       this.beginFill(c2);
  127.       this.drawRect(0,0,_loc3_,_loc2_ - 1);
  128.       this.drawRect(1,1,_loc3_,_loc2_ - 1);
  129.       this.endFill();
  130.       this.beginFill(c3);
  131.       this.drawRect(1,1,_loc3_ - 1,_loc2_ - 1);
  132.       this.drawRect(1,1,_loc3_ - 2,_loc2_ - 2);
  133.       this.endFill();
  134.       this.beginFill(c4);
  135.       this.drawRect(1,1,_loc3_ - 1,_loc2_ - 2);
  136.       this.drawRect(2,2,_loc3_ - 1,_loc2_ - 2);
  137.       this.endFill();
  138.    }
  139.    static function classConstruct()
  140.    {
  141.       mx.core.ext.UIObjectExtensions.Extensions();
  142.       _global.styles.rectBorderClass = mx.skins.sample.RectBorder;
  143.       _global.skinRegistry.RectBorder = true;
  144.       return true;
  145.    }
  146. }
  147.