flex 鼠标中间滚动按钮监听

来源:互联网 发布:古今文胸怎么样知乎 编辑:程序博客网 时间:2024/05/19 16:48

 

<?xml version="1.0" encoding="utf-8"?>

<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"

        layout="vertical"

        verticalAlign="middle"

        backgroundColor="white"

        creationComplete="init()">

 

    <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>

原创粉丝点击