Question

Right click on a Spark Button triggers a state change from "over" to "up".

Instead I would like the state to be "down", so the button behaves the same on left or rightclick.

Is this possible?

Was it helpful?

Solution

Yes it is!

var b:Boolean;

protected function rightMouseDown(e:MouseEvent):void {
    b = true;
}

protected function rightMouseUp(e:MouseEvent):void {
    b = false;
}

override public function setCurrentState(stateName:String, playTransition:Boolean = true):void {
    if (!b) {
        super.setCurrentState(stateName, playTransition);
    } else {
        super.setCurrentState(...);
    }
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top