home *** CD-ROM | disk | FTP | other *** search
/ Hentai Interactivo 50 / HENTAI_50.iso / flip3.swf / scripts / __Packages / mx / controls / Button.as next >
Text File  |  2008-08-13  |  9KB  |  334 lines

  1. class mx.controls.Button extends mx.controls.SimpleButton
  2. {
  3.    static var symbolName = "Button";
  4.    static var symbolOwner = mx.controls.Button;
  5.    var className = "Button";
  6.    static var version = "2.0.2.127";
  7.    var btnOffset = 0;
  8.    var _color = "buttonColor";
  9.    var __label = "default value";
  10.    var __labelPlacement = "right";
  11.    var falseUpSkin = "ButtonSkin";
  12.    var falseDownSkin = "ButtonSkin";
  13.    var falseOverSkin = "ButtonSkin";
  14.    var falseDisabledSkin = "ButtonSkin";
  15.    var trueUpSkin = "ButtonSkin";
  16.    var trueDownSkin = "ButtonSkin";
  17.    var trueOverSkin = "ButtonSkin";
  18.    var trueDisabledSkin = "ButtonSkin";
  19.    var falseUpIcon = "";
  20.    var falseDownIcon = "";
  21.    var falseOverIcon = "";
  22.    var falseDisabledIcon = "";
  23.    var trueUpIcon = "";
  24.    var trueDownIcon = "";
  25.    var trueOverIcon = "";
  26.    var trueDisabledIcon = "";
  27.    var clipParameters = {labelPlacement:1,icon:1,toggle:1,selected:1,label:1};
  28.    static var mergedClipParameters = mx.core.UIObject.mergeClipParameters(mx.controls.Button.prototype.clipParameters,mx.controls.SimpleButton.prototype.clipParameters);
  29.    var centerContent = true;
  30.    var borderW = 1;
  31.    function Button()
  32.    {
  33.       super();
  34.    }
  35.    function init(Void)
  36.    {
  37.       super.init();
  38.    }
  39.    function draw()
  40.    {
  41.       if(this.initializing)
  42.       {
  43.          this.labelPath.visible = true;
  44.       }
  45.       super.draw();
  46.       if(this.initIcon != undefined)
  47.       {
  48.          this._setIcon(this.initIcon);
  49.       }
  50.       delete this.initIcon;
  51.    }
  52.    function onRelease(Void)
  53.    {
  54.       super.onRelease();
  55.    }
  56.    function createChildren(Void)
  57.    {
  58.       super.createChildren();
  59.    }
  60.    function setSkin(tag, linkageName, initobj)
  61.    {
  62.       return super.setSkin(tag,linkageName,initobj);
  63.    }
  64.    function viewSkin(varName)
  65.    {
  66.       var _loc3_ = !this.getState() ? "false" : "true";
  67.       _loc3_ += !this.enabled ? "disabled" : this.phase;
  68.       super.viewSkin(varName,{styleName:this,borderStyle:_loc3_});
  69.    }
  70.    function invalidateStyle(c)
  71.    {
  72.       this.labelPath.invalidateStyle(c);
  73.       super.invalidateStyle(c);
  74.    }
  75.    function setColor(c)
  76.    {
  77.       var _loc2_ = 0;
  78.       while(_loc2_ < 8)
  79.       {
  80.          this[this.idNames[_loc2_]].redraw(true);
  81.          _loc2_ = _loc2_ + 1;
  82.       }
  83.    }
  84.    function setEnabled(enable)
  85.    {
  86.       this.labelPath.enabled = enable;
  87.       super.setEnabled(enable);
  88.    }
  89.    function calcSize(tag, ref)
  90.    {
  91.       if(this.__width == undefined || this.__height == undefined)
  92.       {
  93.          return undefined;
  94.       }
  95.       if(tag < 7)
  96.       {
  97.          ref.setSize(this.__width,this.__height,true);
  98.       }
  99.    }
  100.    function size(Void)
  101.    {
  102.       this.setState(this.getState());
  103.       this.setHitArea(this.__width,this.__height);
  104.       var _loc3_ = 0;
  105.       while(_loc3_ < 8)
  106.       {
  107.          var _loc4_ = this.idNames[_loc3_];
  108.          if(typeof this[_loc4_] == "movieclip")
  109.          {
  110.             this[_loc4_].setSize(this.__width,this.__height,true);
  111.          }
  112.          _loc3_ = _loc3_ + 1;
  113.       }
  114.       super.size();
  115.    }
  116.    function set labelPlacement(val)
  117.    {
  118.       this.__labelPlacement = val;
  119.       this.invalidate();
  120.    }
  121.    function get labelPlacement()
  122.    {
  123.       return this.__labelPlacement;
  124.    }
  125.    function getLabelPlacement(Void)
  126.    {
  127.       return this.__labelPlacement;
  128.    }
  129.    function setLabelPlacement(val)
  130.    {
  131.       this.__labelPlacement = val;
  132.       this.invalidate();
  133.    }
  134.    function getBtnOffset(Void)
  135.    {
  136.       if(this.getState())
  137.       {
  138.          var _loc2_ = this.btnOffset;
  139.       }
  140.       else if(this.phase == "down")
  141.       {
  142.          _loc2_ = this.btnOffset;
  143.       }
  144.       else
  145.       {
  146.          _loc2_ = 0;
  147.       }
  148.       return _loc2_;
  149.    }
  150.    function setView(offset)
  151.    {
  152.       var _loc16_ = !offset ? 0 : this.btnOffset;
  153.       var _loc12_ = this.getLabelPlacement();
  154.       var _loc7_ = 0;
  155.       var _loc6_ = 0;
  156.       var _loc9_ = 0;
  157.       var _loc8_ = 0;
  158.       var _loc5_ = 0;
  159.       var _loc4_ = 0;
  160.       var _loc3_ = this.labelPath;
  161.       var _loc2_ = this.iconName;
  162.       var _loc15_ = _loc3_.textWidth;
  163.       var _loc14_ = _loc3_.textHeight;
  164.       var _loc10_ = this.__width - this.borderW - this.borderW;
  165.       var _loc11_ = this.__height - this.borderW - this.borderW;
  166.       if(_loc2_ != undefined)
  167.       {
  168.          _loc7_ = _loc2_._width;
  169.          _loc6_ = _loc2_._height;
  170.       }
  171.       if(_loc12_ == "left" || _loc12_ == "right")
  172.       {
  173.          if(_loc3_ != undefined)
  174.          {
  175.             _loc3_._width = _loc9_ = Math.min(_loc10_ - _loc7_,_loc15_ + 5);
  176.             _loc3_._height = _loc8_ = Math.min(_loc11_,_loc14_ + 5);
  177.          }
  178.          if(_loc12_ == "right")
  179.          {
  180.             _loc5_ = _loc7_;
  181.             if(this.centerContent)
  182.             {
  183.                _loc5_ += (_loc10_ - _loc9_ - _loc7_) / 2;
  184.             }
  185.             _loc2_._x = _loc5_ - _loc7_;
  186.          }
  187.          else
  188.          {
  189.             _loc5_ = _loc10_ - _loc9_ - _loc7_;
  190.             if(this.centerContent)
  191.             {
  192.                _loc5_ /= 2;
  193.             }
  194.             _loc2_._x = _loc5_ + _loc9_;
  195.          }
  196.          _loc2_._y = _loc4_ = 0;
  197.          if(this.centerContent)
  198.          {
  199.             _loc2_._y = (_loc11_ - _loc6_) / 2;
  200.             _loc4_ = (_loc11_ - _loc8_) / 2;
  201.          }
  202.          if(!this.centerContent)
  203.          {
  204.             _loc2_._y += Math.max(0,(_loc8_ - _loc6_) / 2);
  205.          }
  206.       }
  207.       else
  208.       {
  209.          if(_loc3_ != undefined)
  210.          {
  211.             _loc3_._width = _loc9_ = Math.min(_loc10_,_loc15_ + 5);
  212.             _loc3_._height = _loc8_ = Math.min(_loc11_ - _loc6_,_loc14_ + 5);
  213.          }
  214.          _loc5_ = (_loc10_ - _loc9_) / 2;
  215.          _loc2_._x = (_loc10_ - _loc7_) / 2;
  216.          if(_loc12_ == "top")
  217.          {
  218.             _loc4_ = _loc11_ - _loc8_ - _loc6_;
  219.             if(this.centerContent)
  220.             {
  221.                _loc4_ /= 2;
  222.             }
  223.             _loc2_._y = _loc4_ + _loc8_;
  224.          }
  225.          else
  226.          {
  227.             _loc4_ = _loc6_;
  228.             if(this.centerContent)
  229.             {
  230.                _loc4_ += (_loc11_ - _loc8_ - _loc6_) / 2;
  231.             }
  232.             _loc2_._y = _loc4_ - _loc6_;
  233.          }
  234.       }
  235.       var _loc13_ = this.borderW + _loc16_;
  236.       _loc3_._x = _loc5_ + _loc13_;
  237.       _loc3_._y = _loc4_ + _loc13_;
  238.       _loc2_._x += _loc13_;
  239.       _loc2_._y += _loc13_;
  240.    }
  241.    function set label(lbl)
  242.    {
  243.       this.setLabel(lbl);
  244.    }
  245.    function setLabel(label)
  246.    {
  247.       if(label == "")
  248.       {
  249.          this.labelPath.removeTextField();
  250.          this.refresh();
  251.          return undefined;
  252.       }
  253.       if(this.labelPath == undefined)
  254.       {
  255.          var _loc2_ = this.createLabel("labelPath",200,label);
  256.          _loc2_._width = _loc2_.textWidth + 5;
  257.          _loc2_._height = _loc2_.textHeight + 5;
  258.          if(this.initializing)
  259.          {
  260.             _loc2_.visible = false;
  261.          }
  262.       }
  263.       else
  264.       {
  265.          delete this.labelPath.__text;
  266.          this.labelPath.text = label;
  267.          this.refresh();
  268.       }
  269.    }
  270.    function getLabel(Void)
  271.    {
  272.       return this.labelPath.__text == undefined ? this.labelPath.text : this.labelPath.__text;
  273.    }
  274.    function get label()
  275.    {
  276.       return this.getLabel();
  277.    }
  278.    function _getIcon(Void)
  279.    {
  280.       return this._iconLinkageName;
  281.    }
  282.    function get icon()
  283.    {
  284.       if(this.initializing)
  285.       {
  286.          return this.initIcon;
  287.       }
  288.       return this._iconLinkageName;
  289.    }
  290.    function _setIcon(linkage)
  291.    {
  292.       if(this.initializing)
  293.       {
  294.          if(linkage == "")
  295.          {
  296.             return undefined;
  297.          }
  298.          this.initIcon = linkage;
  299.       }
  300.       else
  301.       {
  302.          if(linkage == "")
  303.          {
  304.             this.removeIcons();
  305.             return undefined;
  306.          }
  307.          super.changeIcon(0,linkage);
  308.          super.changeIcon(1,linkage);
  309.          super.changeIcon(3,linkage);
  310.          super.changeIcon(4,linkage);
  311.          super.changeIcon(5,linkage);
  312.          this._iconLinkageName = linkage;
  313.          this.refresh();
  314.       }
  315.    }
  316.    function set icon(linkage)
  317.    {
  318.       this._setIcon(linkage);
  319.    }
  320.    function setHitArea(w, h)
  321.    {
  322.       if(this.hitArea_mc == undefined)
  323.       {
  324.          this.createEmptyObject("hitArea_mc",100);
  325.       }
  326.       var _loc2_ = this.hitArea_mc;
  327.       _loc2_.clear();
  328.       _loc2_.beginFill(16711680);
  329.       _loc2_.drawRect(0,0,w,h);
  330.       _loc2_.endFill();
  331.       _loc2_.setVisible(false);
  332.    }
  333. }
  334.