<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Disable browser scrolling when using map. in ArcGIS API for Flex Questions</title>
    <link>https://community.esri.com/t5/arcgis-api-for-flex-questions/disable-browser-scrolling-when-using-map/m-p/159658#M3742</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Jason,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp; Strange... you said you are putting this in the main.mxml which is the main application right?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Well you could try this but it is basically the same thing:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_macro_code jive_text_macro"&gt;MouseWheelTrap.setup(this.parentApplication.stage);&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 30 Nov 2010 20:06:59 GMT</pubDate>
    <dc:creator>RobertScheitlin__GISP</dc:creator>
    <dc:date>2010-11-30T20:06:59Z</dc:date>
    <item>
      <title>Disable browser scrolling when using map.</title>
      <link>https://community.esri.com/t5/arcgis-api-for-flex-questions/disable-browser-scrolling-when-using-map/m-p/159654#M3738</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hello All,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; If you've ever embedded a flex map into a browser, you've probably noticed that when you use the scroll wheel to zoom in or out, you also scroll the browser window as well. I was looking for a way to disable the browser window scrolling when you're over the map when I found &lt;/SPAN&gt;&lt;A href="http://code.google.com/p/mousewheeltrap" rel="nofollow noopener noreferrer" target="_blank"&gt;&lt;SPAN style="color: &amp;quot;RoyalBlue&amp;quot;; text-decoration: underline;"&gt;MouseWheelTrap&lt;/SPAN&gt;&lt;/A&gt;&lt;SPAN&gt;. Basically, you copy the following class package into your project, and then call for it in your main.mxml:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
package com.esri.ags.script 
{
 import flash.display.Stage;
 import flash.errors.IllegalOperationError;
 import flash.events.Event;
 import flash.events.MouseEvent;
 import flash.external.ExternalInterface;
 
 /**
&amp;nbsp; * MouseWheelTrap - stops simultaneous browser/Flash mousewheel scrolling
&amp;nbsp; * @author Liam O'Donnell
&amp;nbsp; * @version 1.0
&amp;nbsp; * @usage Simply call the static method MouseWheelTrap.setup(stage);
&amp;nbsp; * @see http://www.spikything.com/blog/?s=mousewheeltrap for info/updates
&amp;nbsp; * This software is released under the MIT License &amp;lt;http://www.opensource.org/licenses/mit-license.php&amp;gt;
&amp;nbsp; * Â© 2009 spikything.com
&amp;nbsp; */
 public class MouseWheelTrap
 {
&amp;nbsp; static private const JAVASCRIPT :String = "var browserScrolling;function allowBrowserScroll(value){browserScrolling=value;}function handle(delta){if(!browserScrolling){return false;}return true;}function wheel(event){var delta=0;if(!event){event=window.event;}if(event.wheelDelta){delta=event.wheelDelta/120;if(window.opera){delta=-delta;}}else if(event.detail){delta=-event.detail/3;}if(delta){handle(delta);}if(!browserScrolling){if(event.preventDefault){event.preventDefault();}event.returnValue=false;}}if(window.addEventListener){window.addEventListener('DOMMouseScroll',wheel,false);}window.onmousewheel=document.onmousewheel=wheel;allowBrowserScroll(true);";
&amp;nbsp; static private const JS_METHOD :String = "allowBrowserScroll";
&amp;nbsp; static private var _browserScrollEnabled :Boolean = true;
&amp;nbsp; static private var _mouseWheelTrapped :Boolean = false;
&amp;nbsp; private const INSTANTIATION_ERROR :String = "Don't instantiate com.spikything.utils.MouseWheelTrap directly. Just call MouseWheelTrap.setup(stage);";
&amp;nbsp; 
&amp;nbsp; public function MouseWheelTrap()
&amp;nbsp; {
&amp;nbsp;&amp;nbsp; throw new IllegalOperationError(INSTANTIATION_ERROR);
&amp;nbsp; }
&amp;nbsp; 
&amp;nbsp; /// Sets up the Flash and the browser to deal with turning browser scrolling on/off as the mouse cursor enters and leaves the stage (a valid reference to stage is required)
&amp;nbsp; static public function setup(stage:Stage):void 
&amp;nbsp; {
&amp;nbsp;&amp;nbsp; stage.addEventListener(MouseEvent.MOUSE_MOVE, function(e:* = null):void { allowBrowserScroll(false); } );
&amp;nbsp;&amp;nbsp; stage.addEventListener(Event.MOUSE_LEAVE, function(e:* = null):void { allowBrowserScroll(true); } );
&amp;nbsp; }
&amp;nbsp; 
&amp;nbsp; static private function allowBrowserScroll(allow:Boolean):void
&amp;nbsp; {
&amp;nbsp;&amp;nbsp; createMouseWheelTrap();
&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp; if (allow == _browserScrollEnabled)
&amp;nbsp;&amp;nbsp;&amp;nbsp; return;
&amp;nbsp;&amp;nbsp; _browserScrollEnabled = allow;
&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp; if (ExternalInterface.available) {
&amp;nbsp;&amp;nbsp;&amp;nbsp; ExternalInterface.call(JS_METHOD, _browserScrollEnabled);
&amp;nbsp;&amp;nbsp;&amp;nbsp; return;
&amp;nbsp;&amp;nbsp; }
&amp;nbsp; }
&amp;nbsp; 
&amp;nbsp; static private function createMouseWheelTrap():void
&amp;nbsp; {
&amp;nbsp;&amp;nbsp; if (_mouseWheelTrapped) 
&amp;nbsp;&amp;nbsp;&amp;nbsp; return;
&amp;nbsp;&amp;nbsp; _mouseWheelTrapped = true;
&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp; if (ExternalInterface.available) {
&amp;nbsp;&amp;nbsp;&amp;nbsp; ExternalInterface.call("eval", JAVASCRIPT);
&amp;nbsp;&amp;nbsp;&amp;nbsp; return;
&amp;nbsp;&amp;nbsp; }
&amp;nbsp; }
&amp;nbsp; 
 }
 
}
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Then you call it in your main.mxml with:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
import com.esri.ags.script.MouseWheelTrap;
MouseWheelTrap.setup(stage);
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This seems pretty straightforward, but I get the error, "1120: Access of undefined property stage" when I compile. There must be a simple fix to this that I'm not getting... Any Ideas?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks for your help.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 08:25:23 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-flex-questions/disable-browser-scrolling-when-using-map/m-p/159654#M3738</guid>
      <dc:creator>JasonLevine</dc:creator>
      <dc:date>2021-12-11T08:25:23Z</dc:date>
    </item>
    <item>
      <title>Re: Disable browser scrolling when using map.</title>
      <link>https://community.esri.com/t5/arcgis-api-for-flex-questions/disable-browser-scrolling-when-using-map/m-p/159655#M3739</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Here's another solution:&lt;/SPAN&gt;&lt;BR /&gt;&lt;A href="http://forums.esri.com/Thread.asp?c=158&amp;amp;f=2421&amp;amp;t=274624#871027"&gt;http://forums.esri.com/Thread.asp?c=158&amp;amp;f=2421&amp;amp;t=274624#871027&lt;/A&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 30 Nov 2010 19:39:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-flex-questions/disable-browser-scrolling-when-using-map/m-p/159655#M3739</guid>
      <dc:creator>DasaPaddock</dc:creator>
      <dc:date>2010-11-30T19:39:21Z</dc:date>
    </item>
    <item>
      <title>Re: Disable browser scrolling when using map.</title>
      <link>https://community.esri.com/t5/arcgis-api-for-flex-questions/disable-browser-scrolling-when-using-map/m-p/159656#M3740</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Jason,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp; Have you tried &lt;/SPAN&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_macro_code jive_text_macro"&gt;MouseWheelTrap.setup(parentApplication.stage);&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 30 Nov 2010 19:39:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-flex-questions/disable-browser-scrolling-when-using-map/m-p/159656#M3740</guid>
      <dc:creator>RobertScheitlin__GISP</dc:creator>
      <dc:date>2010-11-30T19:39:53Z</dc:date>
    </item>
    <item>
      <title>Re: Disable browser scrolling when using map.</title>
      <link>https://community.esri.com/t5/arcgis-api-for-flex-questions/disable-browser-scrolling-when-using-map/m-p/159657#M3741</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi Robert,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; When I try that, I get "Access of undefined property parentApplication".&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;-Jason&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 30 Nov 2010 20:03:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-flex-questions/disable-browser-scrolling-when-using-map/m-p/159657#M3741</guid>
      <dc:creator>JasonLevine</dc:creator>
      <dc:date>2010-11-30T20:03:08Z</dc:date>
    </item>
    <item>
      <title>Re: Disable browser scrolling when using map.</title>
      <link>https://community.esri.com/t5/arcgis-api-for-flex-questions/disable-browser-scrolling-when-using-map/m-p/159658#M3742</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Jason,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp; Strange... you said you are putting this in the main.mxml which is the main application right?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Well you could try this but it is basically the same thing:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_macro_code jive_text_macro"&gt;MouseWheelTrap.setup(this.parentApplication.stage);&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 30 Nov 2010 20:06:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-flex-questions/disable-browser-scrolling-when-using-map/m-p/159658#M3742</guid>
      <dc:creator>RobertScheitlin__GISP</dc:creator>
      <dc:date>2010-11-30T20:06:59Z</dc:date>
    </item>
    <item>
      <title>Re: Disable browser scrolling when using map.</title>
      <link>https://community.esri.com/t5/arcgis-api-for-flex-questions/disable-browser-scrolling-when-using-map/m-p/159659#M3743</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Robert,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; This gives the error "1042:The this keyword can not be used in static methods.&amp;nbsp; It can only be used in instance methods, function closures, and global code."&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Yes, this is in the Main.mxml file which contains the map.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;-Jason&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 30 Nov 2010 20:14:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-flex-questions/disable-browser-scrolling-when-using-map/m-p/159659#M3743</guid>
      <dc:creator>JasonLevine</dc:creator>
      <dc:date>2010-11-30T20:14:21Z</dc:date>
    </item>
    <item>
      <title>Re: Disable browser scrolling when using map.</title>
      <link>https://community.esri.com/t5/arcgis-api-for-flex-questions/disable-browser-scrolling-when-using-map/m-p/159660#M3744</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Jason,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp; Can you attach you main.mxml? sounds like you are trying to use the code outside a function which is not allowed.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 30 Nov 2010 20:18:00 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-flex-questions/disable-browser-scrolling-when-using-map/m-p/159660#M3744</guid>
      <dc:creator>RobertScheitlin__GISP</dc:creator>
      <dc:date>2010-11-30T20:18:00Z</dc:date>
    </item>
    <item>
      <title>Re: Disable browser scrolling when using map.</title>
      <link>https://community.esri.com/t5/arcgis-api-for-flex-questions/disable-browser-scrolling-when-using-map/m-p/159661#M3745</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi Robert,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp; Attached is my Main.mxml.&amp;nbsp; You're right, I was using it outside a function.&amp;nbsp; I created a creationcomplete function with it and although it compiled, it didn't work.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks for your help,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Jason&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 30 Nov 2010 20:44:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-flex-questions/disable-browser-scrolling-when-using-map/m-p/159661#M3745</guid>
      <dc:creator>JasonLevine</dc:creator>
      <dc:date>2010-11-30T20:44:08Z</dc:date>
    </item>
    <item>
      <title>Re: Disable browser scrolling when using map.</title>
      <link>https://community.esri.com/t5/arcgis-api-for-flex-questions/disable-browser-scrolling-when-using-map/m-p/159662#M3746</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I gave up on getting this to work and found an effective workaround:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Place the following code in the HEAD of your html page that has the embedded swf file:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
&amp;lt;script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/dojo/1.3.1/dojo/dojo.xd.js"&amp;gt;&amp;lt;/script&amp;gt;
&amp;lt;script type="text/javascript"&amp;gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; dojo.addOnLoad(function() {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var obj = dojo.byId("myId");
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (obj) {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var connection = dojo.connect(obj, dojo.isMozilla ? "DOMMouseScroll" : "onmousewheel", dojo.stopEvent);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; dojo.addOnWindowUnload(function() { dojo.disconnect(connection); }); // cleanup
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }
&amp;nbsp;&amp;nbsp;&amp;nbsp; });
&amp;lt;/script&amp;gt;
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;It works pretty well.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;-Jason&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 08:25:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-flex-questions/disable-browser-scrolling-when-using-map/m-p/159662#M3746</guid>
      <dc:creator>JasonLevine</dc:creator>
      <dc:date>2021-12-11T08:25:26Z</dc:date>
    </item>
    <item>
      <title>Re: Disable browser scrolling when using map.</title>
      <link>https://community.esri.com/t5/arcgis-api-for-flex-questions/disable-browser-scrolling-when-using-map/m-p/159663#M3747</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Jason,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp; Glad to hear that you got this worked out. I will make a mental note of this solution that worked.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 03 Dec 2010 01:37:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-flex-questions/disable-browser-scrolling-when-using-map/m-p/159663#M3747</guid>
      <dc:creator>RobertScheitlin__GISP</dc:creator>
      <dc:date>2010-12-03T01:37:29Z</dc:date>
    </item>
    <item>
      <title>Re: Disable browser scrolling when using map.</title>
      <link>https://community.esri.com/t5/arcgis-api-for-flex-questions/disable-browser-scrolling-when-using-map/m-p/159664#M3748</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Should the javascript implementation also work on the flexviewer (we are still using V2.4) when embedded via an I-frame into another website, like: &lt;/SPAN&gt;&lt;A href="http://www.pbl.nl/en/roadsfromrio/trends-in-biodiversity-loss"&gt;http://www.pbl.nl/en/roadsfromrio/trends-in-biodiversity-loss&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Do I need to change the "myId" value to flashcontent?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;For some reason the browser keeps scrolling...&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I also can't get the MouseWheelTrap flex variant in action. Like JALevine mentions: it compiles without error, but no change in the website.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Any help appreciated!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Johan&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 08 Feb 2013 08:58:02 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-flex-questions/disable-browser-scrolling-when-using-map/m-p/159664#M3748</guid>
      <dc:creator>JohanMeijer</dc:creator>
      <dc:date>2013-02-08T08:58:02Z</dc:date>
    </item>
    <item>
      <title>Re: Disable browser scrolling when using map.</title>
      <link>https://community.esri.com/t5/arcgis-api-for-flex-questions/disable-browser-scrolling-when-using-map/m-p/159665#M3749</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I was able to get mouse trap working, not in the flexviewer but in an Iframe with a simple map. Displayed is the actionscript file, and just initialize this function on startup&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&amp;nbsp;&amp;nbsp; private function init():void
&amp;nbsp;&amp;nbsp; { 
&amp;nbsp;&amp;nbsp;&amp;nbsp; MouseWheelTrap.setup(stage);
&amp;nbsp;&amp;nbsp; }&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;package com.sample 
{
 
 import flash.display.Stage;
 import flash.events.Event;
 import flash.events.MouseEvent;
 import flash.external.ExternalInterface;
 import mx.core.Application;
 import mx.core.mx_internal;
 
 /**
&amp;nbsp; * MouseWheelTrap - Simultaneous browser/Flash mousewheel scroll issue work-around
&amp;nbsp; * @version 0.1
&amp;nbsp; * @author Liam O'Donnell
&amp;nbsp; * @usage Simply call the static method MouseWheelTrap.setup(stage)
&amp;nbsp; * @see http://www.spikything.com/blog/?s=mousewheeltrap for updates
&amp;nbsp; * This software is released under the MIT License &amp;lt;http://www.opensource.org/licenses/mit-license.php&amp;gt;
&amp;nbsp; * (c) 2009 spikything.com
&amp;nbsp; */
 

public class MouseWheelTrap {
 
 static private var _mouseWheelTrapped :Boolean;
 
 public static function setup(mainStage:Stage):void {
&amp;nbsp; 
&amp;nbsp; mx.core.FlexGlobals.topLevelApplication.addEventListener(MouseEvent.ROLL_OVER, function():void{ 
&amp;nbsp;&amp;nbsp; allowBrowserScroll(false); 
&amp;nbsp; }
&amp;nbsp; );
&amp;nbsp; 
&amp;nbsp; //i added 'mx.core.FlexGlobals.topLevelApplication.'making it work better for flex. use 'stage' for flash&amp;nbsp; 
&amp;nbsp; mx.core.FlexGlobals.topLevelApplication.addEventListener(MouseEvent.ROLL_OUT, function():void{ 
&amp;nbsp;&amp;nbsp; allowBrowserScroll(true); 
&amp;nbsp; }
&amp;nbsp; );
 }
 
 private static function allowBrowserScroll(allow:Boolean):void
 {
&amp;nbsp; createMouseWheelTrap();
&amp;nbsp; if (ExternalInterface.available){
&amp;nbsp;&amp;nbsp; ExternalInterface.call("allowBrowserScroll", allow);
&amp;nbsp; }
 }
 private static function createMouseWheelTrap():void
 {
&amp;nbsp; if (_mouseWheelTrapped) {return;} _mouseWheelTrapped = true; 
&amp;nbsp; if (ExternalInterface.available){
&amp;nbsp;&amp;nbsp; ExternalInterface.call("eval", "var browserScrolling;function allowBrowserScroll(value){browserScrolling=value;}function handle(delta){if(!browserScrolling){return false;}return true;}function wheel(event){var delta=0;if(!event){event=window.event;}if(event.wheelDelta){delta=event.wheelDelta/120;}else if(event.detail){delta=-event.detail/3;}if(delta){handle(delta);}if(!browserScrolling){if(event.preventDefault){event.preventDefault();}event.returnValue=false;}}if(window.addEventListener){window.addEventListener('DOMMouseScroll',wheel,false);}window.onmousewheel=document.onmousewheel=wheel;allowBrowserScroll(true);");
&amp;nbsp; }
 }
}
}&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I tried using the javascript, it worked when the map was embedded on the page but not when the map was in an iframe.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 08:25:28 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-flex-questions/disable-browser-scrolling-when-using-map/m-p/159665#M3749</guid>
      <dc:creator>AaronNash1</dc:creator>
      <dc:date>2021-12-11T08:25:28Z</dc:date>
    </item>
  </channel>
</rss>

