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>
 

    A+
发布日期:2009年05月11日  所属分类:未分类

发表评论

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: