View Single Post
  #1 (permalink)  
Old 10-31-2007, 03:00 AM
arunsamini arunsamini is offline
D-Web Trainee
 
Join Date: Oct 2007
Posts: 8
arunsamini is on a distinguished road
Post How to use the short cuts for button in Flash

Hi..Guys.
This is the post for creating shortcut for button and working with it. The following steps followed for creating shortcuts....

1)create two button with name as btn1 and btn2
2)then add the following code to main timeline

//AS 2.0 coding
var keyListener:Object=new Object();
keyListener.onKeyDown=function(){
if(Key.getCode()==89)
{
Selection.setFocus(btn1);
btn1.onRelease();
}
else if(Key.getCode()==78){
Selection.setFocus(btn2);
btn2.onRelease();
}
}
Key.addListener(keyListener);
btn1._accProps.shortcut = "y";
btn2._accProps.shortcut = "n";
btn1._focusrect=false; //optional
btn2._focusrect=false; //optional
Accessibility.updateProperties();

btn1.onRelease=function(){
trace("btn1");
}
btn2.onRelease=function(){
trace("btn2");
}

3)save and run the application...

Note:
I use the key as "y" and "n" for shortcuts. If u can use ur own shortcuts by setting the Key.getCode() value.

S.Arun
Less Tension Work More

Last edited by arunsamini : 10-31-2007 at 10:39 PM.
Reply With Quote
Sponsored Links