Could someone possibly point out where I'm going wrong with this toggle button and setting icons.
I'm wanting to end up with a button that toggles between and play icon and a stop icon.
_playStopButton = new ToggleButton();
_playStopButton.defaultSkin = _playStopButtonBg;
_playStopButton.downSkin = _playStopButtonHiBg;
_playStopButton.name = "_playStopButton";
_playStopButton.height = 80;
_playStopButton.width = 160;
_playStopButton.setIconForState(ButtonState.UP_AND_SELECTED, _voicePlayIcon);
_playStopButton.setIconForState(ButtonState.DOWN_AND_SELECTED, _voiceStopIcon);
_playStopButton.addEventListener( starling.events.Event.CHANGE, togglePlayStop_changeHandler );
private function togglePlayStop_changeHandler( event:starling.events.Event ):void {
var toggle:ToggleButton = ToggleButton( event.currentTarget );
trace( "playStop:", toggle.isSelected );
if (toggle.isSelected) {
//do something
} else {
//do something
}
}
Thanks,
Mark