flex 设置全局快捷键

前端之家收集整理的这篇文章主要介绍了flex 设置全局快捷键前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical"
	backgroundColor="#FFFFFF"
	applicationComplete="registerGlobalKeyHandler()">
	
	<mx:Script>
		<![CDATA[
			public function registerGlobalKeyHandler() :void
			{
				stage.addEventListener(KeyboardEvent.KEY_UP,handleKeyUP);
			}
			
			public function handleKeyUP(event:KeyboardEvent) :void
			{
				if(e.shiftKey&&(e.keyCode == 76 || e.keyCode == 108))
                                                                 ///在用户按下alt+L时执行相应代码 
			}
		]]>
	</mx:Script>
	
	<mx:Label id="display"
		text="Click anywhere in the application and then press some keys." />
	
</mx:Application>

猜你在找的Flex相关文章