简体   繁体   中英

Flex: Right click button causes state change

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?

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(...);
    }
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM