简体   繁体   中英

flex 4 button down state

I have skin a button with up, down, over, and disable states. I hope to know if there a code enable a button to keep press (down state) when the user press and hold a specific key link to that button. Something like down_button state.

我建议您从Button继承并重写KeyUp处理程序,以在按下Ctrl按钮时保持“向下”状态。

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
<mx:Script>
    <![CDATA[
        private function rotate():void
        {
            can.rotation +=5; 
        }
    ]]>
</mx:Script>
    <mx:Button autoRepeat="true" buttonDown="rotate()" label="Rotate"/>
    <mx:Canvas id="can" backgroundColor="#CA3859" width="200" height="200" horizontalCenter="0" verticalCenter="0"/>    
</mx:Application>

set autoRepeat=true and use buttonDown event, insated of mouseDown. u'll get it

i hope this was ur need, k, use this example and i have flex3 ryt now, so it's in flex3

hav a gr8 time tc

Ankur sharma

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