6 Replies Latest reply on Aug 17, 2011 10:17 AM by Fygo

    (FP Bug?) - Mc's/Sprite's events triggered when mouse leaves SWF area

    Fygo

      Hi guys,

       

      I wonder if somebody had a similar problem and can help out. I have a button on y=0 (may be either Movieclip or Sprite) with two events: ROLL_OVER and ROLL_OUT. Now when the mouse pointer leaves the SWF area, both of these events get triggered, even if the button is not hovered at all. There is no MOUSE_LEAVE event defined nor anything like that (see the code below). I realized that changing the y position of the button helps, strangely small numbers don't - if I set y=1 the bug still occurs, but y=20 solves the problem. What the hell? This happens only in Firefox on Mac, Safari seems to work alright. (FF 5.0.1 and 6 tested, on OSX 10.6.8 and 10.7)

       

      I uploaded a video to youtube in case somebody would be interested of seeing this from Windows (where I assume this doesn't happen, but cannot test at the moment - please leave feedback if you could - http://www.youtube.com/watch?v=YKWl50v_MIo - first 10 seconds are kinda crappy, sorry)

       

      Is this a Flash Player bug or am I missing something really badly here? Thanks!

       

      package {
         
          import flash.display.Sprite;
          import flash.display.Stage;
          import flash.display.StageAlign;
          import flash.display.StageScaleMode;
          import flash.events.Event;
          import flash.events.MouseEvent;
          import flash.display.MovieClip;
          import flash.text.TextField;
         
          public class Main extends Sprite {

       

              private var field:TextField;
             
              public function Main() {
                  stage.align = StageAlign.TOP_LEFT;
                  stage.scaleMode = StageScaleMode.NO_SCALE;
                 
                  //Set up the textfield
                  field = new TextField();
                  field.x = 200;
                  field.y = 200;
                  field.border = true;
                  field.width = 200;
                  field.height = 100;
                  field.wordWrap = true;
                  addChild(field);
                 
                  //Create and set up the MovieClip or Sprite - the MovieClip/Sprite must have content,
                  //cannot be empty, otherwise the bug doesn't appear!
                  var b:MovieClip = new MovieClip();
                  b.graphics.beginFill(0xCCCCCC);
                  b.graphics.drawRect(0, 0, 50, 50);
                  b.graphics.endFill();
                  addChild(b);
                  b.y = 0;
                  b.addEventListener(MouseEvent.ROLL_OVER, rollOverHandler);
                  b.addEventListener(MouseEvent.ROLL_OUT, rollOutHandler);
              }
             
              private function rollOverHandler(e:MouseEvent):void {
                  field.appendText("Over"+new Date().getTime()+"\n");
                  field.scrollV = field.maxScrollV;
              }
             
              private function rollOutHandler(e:MouseEvent):void {
                  field.appendText("Out"+new Date().getTime()+"\n");
                  field.scrollV = field.maxScrollV;
              }
          }
      }