[Laszlo-checkins] r13150 - in openlaszlo/trunk/WEB-INF/lps/lfc/kernel: swf swf9

bargull@openlaszlo.org bargull at openlaszlo.org
Wed Mar 4 02:50:46 PST 2009


Author: bargull
Date: 2009-03-04 02:50:42 -0800 (Wed, 04 Mar 2009)
New Revision: 13150

Modified:
   openlaszlo/trunk/WEB-INF/lps/lfc/kernel/swf/LzSprite.as
   openlaszlo/trunk/WEB-INF/lps/lfc/kernel/swf9/LzSprite.as
Log:
Change 20090303-bargull-cw9 by bargull at dell--p4--2-53 on 2009-03-03 16:24:16
    in /home/Admin/src/svn/openlaszlo/trunk
    for http://svn.openlaszlo.org/openlaszlo/trunk

Summary: fix cross runtime contextmenu handling

New Features:

Bugs Fixed: LPP-7853 (setting "contextmenu" to null produces different results)

Technical Reviewer: hminsky
QA Reviewer: (pending)
Doc Reviewer: (pending)

Documentation:

Release Notes:

Details:
SWF8:
- update _bgcolorhidden-flag in setBGColor() when bgcolor was removed and there is no contextmenu
- use "delete" to remove menu from movieclip resp. remove invisible background clip

SWF9:
- remove invisible background if present and set "contextMenu" to 'null' when removing context-menu
    

Tests:
testcase at bugreport in swf8(debug), swf8(nondebug), swf9, dhtml



Modified: openlaszlo/trunk/WEB-INF/lps/lfc/kernel/swf/LzSprite.as
===================================================================
--- openlaszlo/trunk/WEB-INF/lps/lfc/kernel/swf/LzSprite.as	2009-03-04 09:00:06 UTC (rev 13149)
+++ openlaszlo/trunk/WEB-INF/lps/lfc/kernel/swf/LzSprite.as	2009-03-04 10:50:42 UTC (rev 13150)
@@ -492,6 +492,7 @@
             // opacity setting should not work
             this._bgcolorhidden = true;
         } else {
+            this._bgcolorhidden = false;
             this.bgcolor = null;
             this.removeBG();
         }
@@ -1556,21 +1557,35 @@
     if (! (this.isroot || this instanceof LzTextSprite)) {
         // normal views install the context-menu on their background-clip
         var mb = this.__LZbgRef;
-        if (mb == null) {
-            // if not present, create an invisible clip
-            this.setBGColor(0xffffff);
-            mb = this.__LZbgRef;
-            mb._alpha = 0;
-            this._bgcolorhidden = true;
+        if (cmenu == null) {
+            // remove menu from movieclip
+            if (this._bgcolorhidden) {
+                // remove invisible clip
+                this.setBGColor(null);
+            } else if (mb != null) {
+                delete mb.menu;
+            }
+        } else {
+            if (mb == null) {
+                // if not present, create an invisible clip
+                this.setBGColor(0xffffff);
+                mb = this.__LZbgRef;
+                mb._alpha = 0;
+                this._bgcolorhidden = true;
+            }
+            mb.menu = cmenu;
         }
-        mb.menu = cmenu;
     }
 
     // Install menu on foreground resource clip if there is one,
     // must use _root if canvas
     var mc = this.isroot ? _root : this.getMCRef();
     if (mc != null) {
-        mc.menu = cmenu;
+        if (cmenu == null) {
+            delete mc.menu;
+        } else {
+            mc.menu = cmenu;
+        }
     }
 }
 

Modified: openlaszlo/trunk/WEB-INF/lps/lfc/kernel/swf9/LzSprite.as
===================================================================
--- openlaszlo/trunk/WEB-INF/lps/lfc/kernel/swf9/LzSprite.as	2009-03-04 09:00:06 UTC (rev 13149)
+++ openlaszlo/trunk/WEB-INF/lps/lfc/kernel/swf9/LzSprite.as	2009-03-04 10:50:42 UTC (rev 13150)
@@ -1388,12 +1388,16 @@
        * @param LzContextMenu cmenu: LzContextMenu to install on this view
        */
       function setContextMenu ( lzmenu ){
+          this.__contextmenu = lzmenu;
           if (lzmenu == null) {
-              this.__contextmenu = null;
+              if (this.__bgcolorhidden) {
+                  // remove invisible background
+                  this.__bgcolorhidden = false;
+                  this.bgcolor = null;
+                  this.draw();
+              }
+              this.contextMenu = null;
           } else {
-              this.__contextmenu = lzmenu;
-              var cmenu:ContextMenu = lzmenu.kernel.__LZcontextMenu();
-
               // TODO [hqm 2008-04] make this do the more complex stuff that swf8 LzSprite does now,
               // where it checks for a resource or bgcolor sprite, in order to make the clickable region
               // match what the user expects.
@@ -1404,6 +1408,7 @@
                   this.draw();
               }
 
+              var cmenu:ContextMenu = lzmenu.kernel.__LZcontextMenu();
               // "contextMenu" is a swf9 property on flash.display.Sprite
               this.contextMenu = cmenu;
           }



More information about the Laszlo-checkins mailing list