/**
* http://blog.flexexamples.com/2008/09/08/extending-the-linkbutton-control-in-flex/
*/
package skins {
import mx.skins.halo.LinkButtonSkin;
import mx.styles.StyleManager;
public class CustomLinkButtonSkin1 extends LinkButtonSkin {
public function CustomLinkButtonSkin1() {
super();
}
override protected function updateDisplayList(w:Number, h:Number):void {
super.updateDisplayList(w, h);
var cornerRadius:Number = getStyle("cornerRadius");
var rollOverColor:uint = getStyle("rollOverColor");
var selectionColor:uint = getStyle("selectionColor");
var toggleBackgroundColor:uint = getStyle("toggleBackgroundColor") || getStyle("themeColor");
graphics.clear();
switch (name) {
case "upSkin":
drawRoundRect(
0,
0,
w,
h,
cornerRadius,
0,
0.0
);
break;
case "selectedUpSkin":
case "selectedOverSkin":
drawRoundRect(0, 0, w, h, cornerRadius, toggleBackgroundColor, 1.0);
break;
case "overSkin":
drawRoundRect(0, 0, w, h, cornerRadius, rollOverColor, 1.0);
break;
case "selectedDownSkin":
case "downSkin":
drawRoundRect(0, 0, w, h, cornerRadius, selectionColor, 1.0);
break;
case "selectedDisabledSkin":
drawRoundRect(0, 0, w, h, cornerRadius, toggleBackgroundColor, 0.2);
break;
case "disabledSkin":
drawRoundRect( 0, 0, w, h, cornerRadius, 0, 0.0);
break;
}
}
}
}