[Laszlo-checkins] r12596 - openlaszlo/trunk/WEB-INF/lps/lfc/kernel/swf9

bargull@openlaszlo.org bargull at openlaszlo.org
Thu Jan 22 04:03:20 PST 2009


Author: bargull
Date: 2009-01-22 04:03:15 -0800 (Thu, 22 Jan 2009)
New Revision: 12596

Modified:
   openlaszlo/trunk/WEB-INF/lps/lfc/kernel/swf9/LFCApplication.as
   openlaszlo/trunk/WEB-INF/lps/lfc/kernel/swf9/LzInputTextSprite.as
   openlaszlo/trunk/WEB-INF/lps/lfc/kernel/swf9/LzTextSprite.as
Log:
Change 20090121-bargull-Z64 by bargull at dell--p4--2-53 on 2009-01-21 23:42:19
    in /home/Admin/src/svn/openlaszlo/trunk
    for http://svn.openlaszlo.org/openlaszlo/trunk

Summary: fix tab focus bug in IE

New Features:

Bugs Fixed: LPP-7610

Technical Reviewer: max
QA Reviewer: promanik
Doc Reviewer: (pending)

Documentation:

Release Notes:

Details:
When "tabEnabled" is set to false on TextFields, a tab-press focuses the next focusable object _outside_ of the flash-app. This is an IE-only issue and has been reported to Adobe. 
To workaround that issue, "tabEnabled" is set to true for IE-FlashPlayer environments and an event-listener for "FocusEvent.KEY_FOCUS_CHANGE" is installed to prevent the default behaviour and give lz.Focus the chance to control the focus handling.
(I also needed to change "LzInputTextSprite#gotBlur", it sets now the focus to the stage instead of null when removes the focus from a TextField.)

    

Tests:
testcase from bugreport



Modified: openlaszlo/trunk/WEB-INF/lps/lfc/kernel/swf9/LFCApplication.as
===================================================================
--- openlaszlo/trunk/WEB-INF/lps/lfc/kernel/swf9/LFCApplication.as	2009-01-22 09:00:09 UTC (rev 12595)
+++ openlaszlo/trunk/WEB-INF/lps/lfc/kernel/swf9/LFCApplication.as	2009-01-22 12:03:15 UTC (rev 12596)
@@ -40,15 +40,16 @@
         _sprite.setChildIndex(child, index);
     }
 
-
     // Allow anyone access to the stage object (see ctor below)
     public static var stage:Stage = null;
 
     // Allow anyone access to write to the debugger
     public static var write:Function;
-    
+
+    // global tabEnabled flag for TextField
+    public static var textfieldTabEnabled:Boolean = false;
+
     public function LFCApplication (sprite:Sprite) {
-
         LFCApplication._sprite = sprite;
         // wait for the ADDED_TO_STAGE event before continuing to init
         LFCApplication._sprite.addEventListener(Event.ADDED_TO_STAGE, initLFC);
@@ -67,6 +68,11 @@
 
         stage.addEventListener(KeyboardEvent.KEY_DOWN,reportKeyDown);
         stage.addEventListener(KeyboardEvent.KEY_UP,reportKeyUp);
+        if (Capabilities.playerType == "ActiveX") {
+            // workaround for flash player bug FP-1355
+            LFCApplication.textfieldTabEnabled = true;
+            stage.addEventListener(FocusEvent.KEY_FOCUS_CHANGE, preventFocusChange);
+        }
 
         // necessary for consistent behavior - in netscape browsers HTML is ignored
         stage.align = StageAlign.TOP_LEFT;
@@ -126,20 +132,19 @@
         LzKeyboardKernel.__keyboardEvent(event, 'onkeydown');
     }
 
+    function preventFocusChange(event:FocusEvent):void {
+        if (event.keyCode == 9) {
+            event.preventDefault();
+        }
+    }
+
     public function runToplevelDefinitions() {
         // overridden by swf9 script compiler
     }
 
-
 }
 
 // Resource library
 // contains {ptype, class, frames, width, height}
 // ptype is one of "ar" (app relative) or "sr" (system relative)
 var LzResourceLibrary = {};
-
-
-
-
-
-

Modified: openlaszlo/trunk/WEB-INF/lps/lfc/kernel/swf9/LzInputTextSprite.as
===================================================================
--- openlaszlo/trunk/WEB-INF/lps/lfc/kernel/swf9/LzInputTextSprite.as	2009-01-22 09:00:09 UTC (rev 12595)
+++ openlaszlo/trunk/WEB-INF/lps/lfc/kernel/swf9/LzInputTextSprite.as	2009-01-22 12:03:15 UTC (rev 12596)
@@ -87,7 +87,7 @@
         this.deselect();
         if (LFCApplication.stage.focus === this.textfield) {
             // remove keyboard control
-            LFCApplication.stage.focus = null;
+            LFCApplication.stage.focus = LFCApplication.stage;
         }
     }
 

Modified: openlaszlo/trunk/WEB-INF/lps/lfc/kernel/swf9/LzTextSprite.as
===================================================================
--- openlaszlo/trunk/WEB-INF/lps/lfc/kernel/swf9/LzTextSprite.as	2009-01-22 09:00:09 UTC (rev 12595)
+++ openlaszlo/trunk/WEB-INF/lps/lfc/kernel/swf9/LzTextSprite.as	2009-01-22 12:03:15 UTC (rev 12596)
@@ -142,7 +142,7 @@
             tfield.height = h;
             tfield.border = false;
             tfield.mouseEnabled = false;
-            tfield.tabEnabled = false;
+            tfield.tabEnabled = LFCApplication.textfieldTabEnabled;
             //tfield.cacheAsBitmap = true;
             addChild(tfield);
             return tfield;



More information about the Laszlo-checkins mailing list