3 Replies Latest reply on May 18, 2007 2:49 AM by lidlid

    modify component buttton

    lidlid
      Hi!

      I need to modify the color for a button components, this button now is green and i want to become blu and in rollover bluelight. But i have not idea of the modify for do that!



      I past here the code!

      in the button components : the name istance is: "Template_ControlButton"
      and the label "Control Button"

      This is fla have 2 frame, in the first frame there is this code:

      _global.style.setStyle("themeColor", 12713984);
      stop ();
      onEnterFrame = function ()
      {
      var _l1 = getBytesLoaded();
      var _l2 = getBytesTotal();
      if (_l1 > 4 && _l2 > 4 && _l1 >= _l2)
      {
      delete onEnterFrame;
      gotoAndPlay(_currentframe + 1);
      }
      else
      {
      var _l3 = Math.round(_l1 / _l2 * 100);
      loader_txt.text = _l3 + " %";
      } // end if
      };


      all is linked to this .as ( RedGreenBlueSkin.as) with this cod

      class RedGreenBlueSkin extends mx.skins.RectBorder
      {
      var _parent;
      function RedGreenBlueSkin()
      {
      super();
      } // End of the function
      function ButtonSkin()
      {
      } // End of the function
      function init()
      {
      super.init();
      } // End of the function
      function size()
      {
      this.drawHaloRect(this.__get__width(), this.__get__height());
      } // End of the function
      function drawHaloRect(w, h)
      {
      var _l5 = this.getStyle("borderStyle");
      var _l6 = this.getStyle("themeColor");
      var _l4 = _parent.emphasized;
      this.clear();
      switch (_l5)
      {
      case "falseup":
      {
      if (_l4)
      {
      this.drawRoundRect(this.__get__x() + 1,
      this.__get__y() + 1, w - 2, h - 2, 4, [16777215, 16777215], 85, 0,
      "radial");
      this.drawRoundRect(this.__get__x() + 2,
      this.__get__y() + 2, w - 4, h - 4, 3, [0, 14342874], 100, 0,
      "radial");
      this.drawRoundRect(this.__get__x() + 3,
      this.__get__y() + 4, w - 6, h - 7, 2, 16316664, 100);
      }
      else
      {
      this.drawRoundRect(1, 1, w - 2, h - 2, 4,
      [11918606, 11918606], 100, 0, "radial");
      this.drawRoundRect(2, 2, w - 4, h - 4, 3,
      [11918606, 11918606], 100, 0, "radial");
      this.drawRoundRect(3, 4, w - 6, h - 7, 2,
      11918606, 100);
      } // end if
      break;
      }
      case "falsedown":
      {
      this.drawRoundRect(this.__get__x() + 1,
      this.__get__y() + 1, w - 2, h - 2, 4, [16766518, 16766518], 100, 0,
      "radial");
      this.drawRoundRect(this.__get__x() + 2,
      this.__get__y() + 2, w - 4, h - 4, 3, [16766518, 16766518], 100, 0,
      "radial");
      this.drawRoundRect(this.__get__x() + 3,
      this.__get__y() + 4, w - 6, h - 7, 2, 16766518, 100);
      break;
      }
      case "falserollover":
      {
      this.drawRoundRect(this.__get__x() + 1,
      this.__get__y() + 1, w - 2, h - 2, 4, [16766518, 16766518], 100, 0,
      "radial");
      this.drawRoundRect(this.__get__x() + 2,
      this.__get__y() + 2, w - 4, h - 4, 3, [16766518, 16766518], 100, 0,
      "radial");
      this.drawRoundRect(this.__get__x() + 3,
      this.__get__y() + 4, w - 6, h - 7, 2, 16766518, 100);
      break;
      }
      case "falsedisabled":
      {
      this.drawRoundRect(1, 1, w - 2, h - 2, 4, 13691237,
      100);
      this.drawRoundRect(2, 2, w - 4, h - 4, 3, 13691237,
      100);
      this.drawRoundRect(3, 3, w - 6, h - 6, 2, 13691237,
      100);
      break;
      }
      case "trueup":
      {
      this.drawRoundRect(this.__get__x() + 1,
      this.__get__y() + 1, w - 2, h - 2, 4, [16766518, 16766518], 100, 0,
      "radial");
      this.drawRoundRect(this.__get__x() + 2,
      this.__get__y() + 2, w - 4, h - 4, 3, [16766518, 16766518], 100, 0,
      "radial");
      this.drawRoundRect(this.__get__x() + 3,
      this.__get__y() + 4, w - 6, h - 7, 2, 16766518, 100);
      break;
      }
      case "truedown":
      {
      this.drawRoundRect(this.__get__x() + 1,
      this.__get__y() + 1, w - 2, h - 2, 4, [16766518, 16766518], 100, 0,
      "radial");
      this.drawRoundRect(this.__get__x() + 2,
      this.__get__y() + 2, w - 4, h - 4, 3, [16766518, 16766518], 100, 0,
      "radial");
      this.drawRoundRect(this.__get__x() + 3,
      this.__get__y() + 4, w - 6, h - 7, 2, 16766518, 100);
      break;
      }
      case "truerollover":
      {
      this.drawRoundRect(this.__get__x() + 1,
      this.__get__y() + 1, w - 2, h - 2, 4, [16766518, 16766518], 100, 0,
      "radial");
      this.drawRoundRect(this.__get__x() + 2,
      this.__get__y() + 2, w - 4, h - 4, 3, [16766518, 16766518], 100, 0,
      "radial");
      this.drawRoundRect(this.__get__x() + 3,
      this.__get__y() + 4, w - 6, h - 7, 2, 16766518, 100);
      break;
      }
      case "truedisabled":
      {
      this.drawRoundRect(1, 1, w - 2, h - 2, 4, 13691237,
      100);
      this.drawRoundRect(2, 2, w - 4, h - 4, 3, 13691237,
      100);
      this.drawRoundRect(3, 3, w - 6, h - 6, 2, 13691237,
      100);
      }
      } // End of switch
      } // End of the function
      static function classConstruct()
      {
      mx.core.ext.UIObjectExtensions.Extensions();
      _global.skinRegistry.ButtonSkin = true;
      return (true);
      } // End of the function
      static var symbolName = "ButtonSkin";
      static var symbolOwner = mx.skins.halo.ButtonSkin;
      var className = "ButtonSkin";
      var backgroundColorName = "buttonColor";
      static var classConstructed = RedGreenBlueSkin.classConstruct();
      static var UIObjectExtensionsDependency =
      mx.core.ext.UIObjectExtensions;
      } // End of Class



      I hope to have insert all code necessary, and sorry for my terrible English!