Adicionando uma imagem ao botao
Olá
Para gerar o botão eu faço da seguinte forma:
class CustomSimpleButton extends SimpleButton {
private var upColor:uint = 0xFFCC00;
private var overColor:uint = 0xCCFF00;
private var downColor:uint = 0x00CCFF;
private var size:uint = 80;
public function CustomSimpleButton(where:uint) {
downState = new ButtonDisplayState(downColor, size, where);
overState = new ButtonDisplayState(overColor, size, where);
upState = new ButtonDisplayState(upColor, size, where);
hitTestState = new ButtonDisplayState(upColor, size * 2, where);
hitTestState.x = -(size / 4);
hitTestState.y = hitTestState.x;
useHandCursor = true;
}
}
class ButtonDisplayState extends Shape {
private var bgColor:uint;
private var size:uint;
private var where:uint;
public function ButtonDisplayState(bgColor:uint, size:uint, where:uint) {
this.bgColor = bgColor;
this.size = size;
this.where = where;
draw();
}
private function draw():void {
graphics.beginFill(bgColor);
graphics.drawRect(where, 330, size, size);
graphics.endFill();
}
}
Na classe chamo assim
var pausar:CustomSimpleButton = new CustomSimpleButton(300);
Como que eu posso fazer para adicionar uma imagem de fundo a esse botão?
Valeu
Discussão (3)
Carregando comentários...