I am migrating code from AS2 to AS3 and came across some unexpected browser behavior -- both the SWF and the surrounding web page are scrolling at the same time.

The following examples are both running in 9,0,28,0 (IE 7 and Firefox 2).

In AS2 (compiled to either v7 or v9), the surrounding web page does NOT scroll while the embedded SWF has focus and captures wheel events.

var mouseListener:Object = new Object();
mouseListener.onMouseWheel = function (delta) {
    myMovieClip._x += delta;
}
Mouse.addListener(mouseListener);


In AS3 (compiled to v9), both the surrounding web page and the embedded SWF scroll at the same time (while the SWF has focus).

myMovieClip.addEventListener(MouseEvent.MOUSE_WHEEL, handleMouseWheel);

private function handleMouseWheel(evt:MouseEvent):void {
    myMovieClip.x += evt.delta;
}


I am trying to prevent the web page from scrolling while the SWF has focus and receives MOUSE_WHEEL events. I have tried stopPropagation () and stopImmediatePropagation() to no avail.

The behavior is the same whether I render the SWF object/embed code via JavaScript or directly in the HTML.

Thoughts?

Thanks,
Adam


_______________________________________________
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

Reply via email to