Uploaded image for project: 'Apache Flex'
  1. Apache Flex
  2. FLEX-23145

In certain situations modules with datagrids cause the mouse to lose focus out of the player

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Cannot Reproduce
    • Adobe Flex SDK 3.4 (Release)
    • None
    • Focus Manager
    • None
    • Affected OS(s): Mac
      Affected OS(s): Mac OS 10.5
      Language Found: English

    Description

      Steps to reproduce:

      1. Using firefox, with heavy datagrids, the flashplayer loses focus from the browser
      2. It happens when scrolling sometimes with a module inside a "big" flex application
      I think vertical height, weight of the application and size of the datagrid are a factor.

      Actual Results:

      Application can hang after this happens and mouse is disabled until a click on the flashplayer which re-focuses, the player, and use of my helper attached below.

      Expected Results:

      For this not to happen

      Workaround (if any):
      This doesn't happen often, or I don't notice it, but this solution or hack works for me.

      A javascript method catches it, I've switched to elfgrid, and the problem doesn't appear as often, as it use to. Here's the javascript function that reassigns focus back to the flashplayer

      var swfmouseup = function()
      {
      if( !swfobject ) return null;
      var u = navigator.userAgent.toLowerCase();
      var p = navigator.platform.toLowerCase();
      var mac = p ? /mac/.test(p) : /mac/.test(u);

      var regObjArr = [];

      var deltaDispatcher = function(event)
      {
      var obj;
      for(var i=0; i<regObjArr.length; i++ )

      { obj = swfobject.getObjectById(regObjArr[i]); if( typeof( obj.externalMouseUpEvent ) == 'function' ) obj.externalMouseUpEvent( 1 ); }

      }

      if (window.addEventListener) window.addEventListener('mouseup', deltaDispatcher, false);
      document.onmouseup = deltaDispatcher;
      document.mouseup = deltaDispatcher;

      return {
      /*
      Public API
      */
      registerObject: function(objectIdStr)

      { regObjArr[regObjArr.length] = objectIdStr; }

      };
      }();

      Here's my as helpe class that handles regaining mouse focus.
      package net.voxel.ui
      {
      import flash.display.InteractiveObject;
      import flash.display.Stage;
      import flash.events.*;
      import flash.external.ExternalInterface;

      public class MouseUpFixer
      {
      private static var instance:MouseUpFixer;

      private var _stage:Stage;
      private var _currItem:InteractiveObject;
      private var _clonedEvent:MouseEvent;

      public static function getInstance():MouseUpFixer

      { if (instance == null) instance = new MouseUpFixer( new SingletonEnforcer() ); return instance; }

      public function MouseUpFixer( enforcer:SingletonEnforcer )
      {
      }

      /*

      • Initialize the MacMouseWheel class
      • @param stage Stage instance e.g DocumentClass.stage
      • */
        public static function setup( stage:Stage ):void

        { getInstance()._setup( stage ); }

      private function _setup( stage:Stage ):void
      {
      _stage = stage;
      _stage.addEventListener( MouseEvent.MOUSE_MOVE, _getItemUnderCursor );
      _stage.addEventListener( Event.MOUSE_LEAVE,onMouseLeave);

      if( ExternalInterface.available )

      { ExternalInterface.addCallback( 'externalMouseUpEvent', _externalMouseUpEvent ); }

      }

      private function onMouseLeave(e:Event):void

      { var mouseUp:MouseEvent = new MouseEvent( MouseEvent.MOUSE_UP, true, false); // _stage.dispatchEvent(mouseUp); }

      private function _getItemUnderCursor( e:MouseEvent ):void

      { _currItem = InteractiveObject( e.target ); _clonedEvent = MouseEvent( e ); }

      private function _externalMouseUpEvent( delta:Number ):void
      {
      trace ("mouseUp Fixerdelta",delta);
      try

      { var mouseUp:MouseEvent = new MouseEvent( MouseEvent.MOUSE_UP, true, false, _clonedEvent.localX, _clonedEvent.localY, _clonedEvent.relatedObject, _clonedEvent.ctrlKey, _clonedEvent.altKey, _clonedEvent.shiftKey, _clonedEvent.buttonDown,0 ); _currItem.dispatchEvent( mouseUp ); }

      catch (e:Error)
      {

      }

      }
      }
      }

      internal class SingletonEnforcer{}

      Attachments

        Activity

          People

            adobejira Adobe JIRA
            adobejira Adobe JIRA
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: