View Single Post
  #2  
Old 12-28-2007, 02:28 AM
seesamjagan seesamjagan is offline
D-Web Programmer
 
Join Date: Aug 2007
Location: Chennai
Posts: 66
seesamjagan is on a distinguished road
Send a message via AIM to seesamjagan Send a message via Yahoo to seesamjagan
Default Re: How to use the short cuts for button in Flash

Hi
i used your code. its working fine

may i know the use of
Quote:
Accessibility.updateProperties();
the above statement in the script?

even though i commented these following two lines
Quote:
//btn1._accProps.shortcut = "y";
//btn2._accProps.shortcut = "n";
its working without any problem . then what is the purpose of those two lines
i tested this code in Flash cs3.

Quote:
Originally Posted by arunsamini View Post
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
__________________
SeeSamJagan
- Sky is not the "LIMIT", Death is not the END, There is still something beyond....
Reply With Quote