Skip to content

feature button states

Harbs edited this page Oct 22, 2017 · 1 revision

Button States

It's currently difficult to specify button states using CSS.

Ideally, it should be possible to specify something like this:

.myButton:hover{
    background-image: url ('assets/button_hover.png');
    background-repeat: no-repeat;
}
.myButton:active{
    background-image: url ('assets/button_active.png');
    background-repeat: no-repeat;
}

Or something like this as is possible in Flex:

Button.special
{
    overSkin: Embed(source="assets/over/special.png"); 
    upSkin: Embed(source="assets/up/special.png");
    downSkin: Embed(source="assets/down/special.png");
    disabledSkin: Embed(source="assets/disabled/special.png");
}

Part of the problem is that ImageButton has no view and ImageButton wraps <img> in HTML. In Flash there is a view which has different Sprites for the different states. I'm not sure if there's a reason why the HTML component does not do the same.

Clone this wiki locally