现在的位置: 首页 > 综合 > 正文

flex 鼠标中间滚动按钮监听

2013年01月28日 ⁄ 综合 ⁄ 共 751字 ⁄ 字号 评论关闭

 

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

抱歉!评论已关闭.