English 中文(简体)
Duplicate mousewheel events in Flash on XP Firefox
原标题:

In Firefox 3, all the mouseWheel events in my Haxe/Flash app are firing twice. This only seems to happen in the Windows version of Firefox; it doesn t happen in IE or Opera, and it doesn t happen in Linux.

Is this a known issue, or could I be doing something wrong? Is there a workaround that doesn t involve something crazy like checking the user agent and ignoring every other event?

Update: I tested on an old powerbook (after incorporating pixelbreaker s SWFMacMouseWheel scripts), and found that while the OS X version of Firefox behaves normally, Safari (3.2.1) is doubling the events too.

I also wrote a simple test in AS3 to make sure it wasn t somehow Haxe s fault; I got the same behavior. The code is below, and you can try it here.

package {
import flash.display.Sprite;
import flash.events.MouseEvent;
import flash.text.TextField;

public class Test extends Sprite {
    public function Test() {
        super();
        var tf: TextField = new TextField();
        tf.height = 300;
        addChild(tf);
        stage.addEventListener(MouseEvent.MOUSE_WHEEL,
                   function(e:MouseEvent):void { tf.appendText(e.delta+"
"); });
    }
}
}
问题回答

I haven t encountered this, even though I ve used the scroll bar for navigation a number of times. However, I have experienced inconsistencies when using a wmode (i.e. not the default windowed mode) such as "transparent" or "opaque".

If you are using a wmode, (e.g. wmode="transparent" in your embedding HTML), try disabling it and see if that changes the behavior.

I hit this too - and since the wheel mouse was controlling slider placement with 3-5 segments it was an obvious glitch.

I ended up creating a timer and making sure 10 milliseconds passed before allowing a new wheel event. Not a perfect solution, but 10 millis feels reasonable.

wheel_mouse_lock_time:Number = new Date().getTime();
...

public function image_wheel_zoom(e:MouseEvent):void {
  var current_time:Number = new Date().getTime();

  if (current_time - wheel_mouse_lock_time < 10){
    return; 
  }

  wheel_mouse_lock_time = ctime;

  //handle event
} 




相关问题
Writing a Web Application in Haxe without Apache and PHP?

Haxe has Apache httpd modules and can compile to PHP code. These are 2 options I know to make a web application that runs on the server. You can start a http server with nekotools, but this is ...

actionscript development on mac

I know of FlashDevelop for windows but how about developing actionscript or haxe on a mac? besides flex plugin for eclipse, flex builder and FDT is there anny good IDE out there for actionscript ...

Duplicate mousewheel events in Flash on XP Firefox

In Firefox 3, all the mouseWheel events in my Haxe/Flash app are firing twice. This only seems to happen in the Windows version of Firefox; it doesn t happen in IE or Opera, and it doesn t happen in ...

perspective in Flash

I have an 2D image that I want to draw in true 3D, and spin around its centre. I m using Actionscript 3 code (actually Haxe, no IDE), and I m struggling to discover the values by experimentation. I ...

How to save an XML file on server with Haxe PHP?

I am just starting out with Haxe development, and wanted to give the PHP side a go, but am already a little confused. What is the best way to save some form data to XML files in a folder on a server ...

热门标签