http://blog.163.com/lujun19888@126/blog/static/308219722009102324152754/
flex鼠标滚轮事件(鼠标滚动后,数字变换)
2009-11-23 14:41:52| 分类: Flex|举报|字号 订阅
<?xml version="1.0" encoding="utf-8"?>
<!-- http://blog.flexexamples.com/2007/08/28/detecting-the-mouse-scroll-wheel-in-a-flex-application/ -->
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
layout="vertical"
verticalAlign="middle"
backgroundColor="white"
creationComplete="init()" viewSourceURL="srcview/index.html">
<mx:Script>
<![CDATA[
private function init():void {
systemManager.addEventListener(MouseEvent.MOUSE_WHEEL, doMouseWheel);
}
private function doMouseWheel(evt:MouseEvent):void {
num += evt.delta;
}
]]>
</mx:Script>
<mx:Number id="num">0</mx:Number>
<mx:NumberFormatter id="numberFormatter" />
<mx:ApplicationControlBar dock="true">
<mx:Label text="Click the stage and scroll mouse wheel to begin." />
</mx:ApplicationControlBar>
<mx:Label text="{numberFormatter.format(num)}"
fontSize="96" />
</mx:Application>