<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Flex Examples &#187; MouseEvent</title>
	<atom:link href="http://blog.flexexamples.com/category/mouseevent/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.flexexamples.com</link>
	<description>Just a bunch of Adobe Flex Examples</description>
	<lastBuildDate>Wed, 26 Jan 2011 18:09:51 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Detecting the mouse scroll wheel in a Flex application</title>
		<link>http://blog.flexexamples.com/2007/08/28/detecting-the-mouse-scroll-wheel-in-a-flex-application/</link>
		<comments>http://blog.flexexamples.com/2007/08/28/detecting-the-mouse-scroll-wheel-in-a-flex-application/#comments</comments>
		<pubDate>Wed, 29 Aug 2007 00:23:11 +0000</pubDate>
		<dc:creator>Peter deHaan</dc:creator>
				<category><![CDATA[Mouse]]></category>
		<category><![CDATA[MouseEvent]]></category>
		<category><![CDATA[delta]]></category>
		<category><![CDATA[mouseWheel]]></category>

		<guid isPermaLink="false">http://blog.flexexamples.com/2007/08/28/detecting-the-mouse-scroll-wheel-in-a-flex-application/</guid>
		<description><![CDATA[<p>The following example demonstrates a very simple Flex application which listens for the mouseWheel event (represented here by the MouseEvent.MOUSE_WHEEL constant) and updates a Label control on the display list.</p> <p></p> &#60;?xml version=&#34;1.0&#34; encoding=&#34;utf-8&#34;?&#62; &#60;!-- http://blog.flexexamples.com/2007/08/28/detecting-the-mouse-scroll-wheel-in-a-flex-application/ --&#62; &#60;mx:Application xmlns:mx=&#34;http://www.adobe.com/2006/mxml&#34; layout=&#34;vertical&#34; verticalAlign=&#34;middle&#34; backgroundColor=&#34;white&#34; creationComplete=&#34;init()&#34;&#62; &#160; &#60;mx:Script&#62; &#60;![CDATA[ private function init():void { systemManager.addEventListener(MouseEvent.MOUSE_WHEEL, doMouseWheel); } &#160; private [...]]]></description>
			<content:encoded><![CDATA[<p>The following example demonstrates a very simple Flex application which listens for the <code>mouseWheel</code> event (represented here by the <code>MouseEvent.MOUSE_WHEEL</code> constant) and updates a Label control on the display list.</p>
<p><span id="more-143"></span></p>

<div class="wp_syntax"><div class="code"><pre class="mxml" style="font-family:monospace;"><span style="color: #000000;">&lt;?xml version=<span style="color: #ff0000;">&quot;1.0&quot;</span> encoding=<span style="color: #ff0000;">&quot;utf-8&quot;</span>?<span style="color: #7400FF;">&gt;</span></span>
<span style="color: #000000;"><span style="color: #808080; font-style: italic;">&lt;!-- http://blog.flexexamples.com/2007/08/28/detecting-the-mouse-scroll-wheel-in-a-flex-application/ --&gt;</span></span>
<span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:Application</span> xmlns:mx=<span style="color: #ff0000;">&quot;http://www.adobe.com/2006/mxml&quot;</span></span>
<span style="color: #000000;">        layout=<span style="color: #ff0000;">&quot;vertical&quot;</span></span>
<span style="color: #000000;">        verticalAlign=<span style="color: #ff0000;">&quot;middle&quot;</span></span>
<span style="color: #000000;">        backgroundColor=<span style="color: #ff0000;">&quot;white&quot;</span></span>
<span style="color: #000000;">        creationComplete=<span style="color: #ff0000;">&quot;init()&quot;</span><span style="color: #7400FF;">&gt;</span></span>
&nbsp;
    <span style="color: #339933;">&lt;mx:Script&gt;</span>
<span style="color: #339933;">        &lt;![CDATA[</span>
<span style="color: #339933;">            private function init():void {</span>
<span style="color: #339933;">                systemManager.addEventListener(MouseEvent.MOUSE_WHEEL, doMouseWheel);</span>
<span style="color: #339933;">            }</span>
&nbsp;
<span style="color: #339933;">            private function doMouseWheel(evt:MouseEvent):void {</span>
<span style="color: #339933;">                num += evt.delta;</span>
<span style="color: #339933;">            }</span>
<span style="color: #339933;">        ]]&gt;</span>
<span style="color: #339933;">    &lt;/mx:Script&gt;</span>
&nbsp;
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:Number</span> id=<span style="color: #ff0000;">&quot;num&quot;</span><span style="color: #7400FF;">&gt;</span></span>0<span style="color: #000000;"><span style="color: #7400FF;">&lt;/mx:Number</span><span style="color: #7400FF;">&gt;</span></span>
&nbsp;
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:NumberFormatter</span> id=<span style="color: #ff0000;">&quot;numberFormatter&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
&nbsp;
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:ApplicationControlBar</span> dock=<span style="color: #ff0000;">&quot;true&quot;</span><span style="color: #7400FF;">&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:Label</span> text=<span style="color: #ff0000;">&quot;Click the stage and scroll mouse wheel to begin.&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;/mx:ApplicationControlBar</span><span style="color: #7400FF;">&gt;</span></span>
&nbsp;
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:Label</span> text=<span style="color: #ff0000;">&quot;{numberFormatter.format(num)}&quot;</span></span>
<span style="color: #000000;">            fontSize=<span style="color: #ff0000;">&quot;96&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
&nbsp;
<span style="color: #000000;"><span style="color: #7400FF;">&lt;/mx:Application</span><span style="color: #7400FF;">&gt;</span></span></pre></div></div>

<p class="information"><a href="http://blog.flexexamples.com/wp-content/uploads/MouseWheel_test/bin/srcview/index.html">View source</a> is enabled in the following example.</p>
<p class="alert">Oops, I had to remove the SWF since it was competing with IE&#8217;s scroll (I&#8217;m using a weird <code>&lt;iframe /&gt;</code> solution for inline samples). <a href="http://blog.flexexamples.com/wp-content/uploads/MouseWheel_test/bin/main.html">To see the sample, click here</a>.</p>
<p>And no, the number has absolutely no significance. It is just a quick way to see if the mouse wheel was responding.</p>
<p><!-- iframe src="http://blog.flexexamples.com/wp-content/uploads/MouseWheel_test/bin/main.html" width="100%" height="220"></iframe --></p>
<div class="evernoteSiteMemory"><a href="javascript:" onclick="Evernote.doClip({title: 'Detecting the mouse scroll wheel in a Flex application on FlexExamples.com',url: 'http://blog.flexexamples.com/2007/08/28/detecting-the-mouse-scroll-wheel-in-a-flex-application/',contentID: 'post-143',code: 'Pete9667',suggestNotebook: 'FlexExamples',suggestTags: 'delta,mouseWheel',providerName: 'FlexExamples.com',styling: 'text' });return false" class="evernoteSiteMemoryLink"><img src="http://static.evernote.com/article-clipper-remember.png" class="evernoteSiteMemoryButton" />
				</a>				<div class="evernoteSiteMemoryClear">&nbsp;</div>
</div>]]></content:encoded>
			<wfw:commentRss>http://blog.flexexamples.com/2007/08/28/detecting-the-mouse-scroll-wheel-in-a-flex-application/feed/</wfw:commentRss>
		<slash:comments>18</slash:comments>
		</item>
	</channel>
</rss>

