0
votes

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.

2
do u want to keep pressing the btn? like for example,you r rotating something by 5 degree on each click of a btn, and now you want to keep pressing that btn, and you want that particular smething to keep rotating, and thn yes thats possible.. - Ankur Sharma

2 Answers

0
votes

I would suggest you inherit from Button and override the KeyUp handler to maintain the "down" state if the Ctrl button is pressed.

0
votes
<?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