Author: max
Date: 2007-10-23 12:21:10 -0700 (Tue, 23 Oct 2007)
New Revision: 6973

Modified:
   openlaszlo/trunk/WEB-INF/lps/lfc/kernel/swf/LzSprite.as
Log:
Change 20071022-maxcarlson-k by [EMAIL PROTECTED] on 2007-10-22 20:30:29 PDT
    in /Users/maxcarlson/openlaszlo/trunk
    for http://svn.openlaszlo.org/openlaszlo/trunk

Summary: Fix context menus to work without bgcolor set

New Features:

Bugs Fixed: LPP-3852 - Context menu doesn't work properly with transparent views

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

Documentation:

Release Notes:

Details: Remove extra assignments of width/height/x/y.  

In setBGColor() if the bgcolor was set for a context menu, reset its alpha to 
the correct value and allow opacity to be applied.  If clearing the bgcolor, 
don't remove the movieclip and don't allow opacity to be applied.

In setOpacity()  set the bgcolor alpha if not set by the context menu and 
overridden by the context menu.

In changeOrder() store and restore the current alpha value of the bgcolor 
movieclip.

In setContextMenu() always add a bgcolor view, and set its alpha to 0 to hide 
it if no bgcolor is currently set.
    

Tests: See LPP-3852.



Modified: openlaszlo/trunk/WEB-INF/lps/lfc/kernel/swf/LzSprite.as
===================================================================
--- openlaszlo/trunk/WEB-INF/lps/lfc/kernel/swf/LzSprite.as     2007-10-23 
19:09:37 UTC (rev 6972)
+++ openlaszlo/trunk/WEB-INF/lps/lfc/kernel/swf/LzSprite.as     2007-10-23 
19:21:10 UTC (rev 6973)
@@ -154,11 +154,6 @@
 // when it has the focus. (see LzFocus for more details)
 LzSprite.prototype.focusable = false;
 
-LzSprite.prototype.width = null;
-LzSprite.prototype.height = null;
-LzSprite.prototype.x = 0;
-LzSprite.prototype.y = 0;
-
 LzSprite.prototype.visible =   true;
 
 LzSprite.prototype.opacity =   1;
@@ -460,9 +455,20 @@
         }
         this.bgcolor = Number(bgc);
         this.applyBG();
+        if (this._bgcolorhidden) {
+            this.__LZbgRef._alpha = this.opacity * 100;
+            // overriding context menu color so opacity setting works
+            this._bgcolorshown = true;
+        }
     } else {
-        this.bgcolor = null;
-        this.removeBG();
+        if (this._bgcolorhidden) {
+            this.__LZbgRef._alpha = 0;
+            //opacity setting should not work
+            this._bgcolorshown = false;
+        } else {
+            this.bgcolor = null;
+            this.removeBG();
+        }
     }
 }
 
@@ -629,7 +635,8 @@
     if (this.__LZmovieClipRef)
         this.__LZmovieClipRef._alpha = 100*v;
 
-    if (this.__LZbgRef)
+    // set the bgcolor alpha if not set by the context menu and overridden by 
the context menu
+    if (this.__LZbgRef && (this._bgcolorhidden != true && this._bgcolorshown 
!= true))
          this.__LZbgRef._alpha = 100*v;
 
     //@event onopacity: Sent when a view changes its opacity
@@ -1139,9 +1146,9 @@
     //Debug.write('got attachPoint', cVMv);
 
     var reback = cSprite.__LZisBackgrounded;
-    var menu = null;
     if (reback) {
-        menu = cSprite.__LZbgRef.menu;
+        var menu = cSprite.__LZbgRef.menu;
+        var al = cSprite.__LZbgRef._alpha;
     }
     cSprite.removeBG();
     while (cSprite.__LZdepth + next < dl.length  && cSprite.__LZdepth+next >= 
0 ){
@@ -1169,15 +1176,18 @@
 
         if ( nv.__LZisBackgrounded ){
             var menu2 = nv.__LZbgRef.menu;
+            var al2 = nv.__LZbgRef._alpha;
             nv.removeBG();
             nv.applyBG();
             nv.__LZbgRef.menu = menu2;
+            nv.__LZbgRef._alpha = al2;
         }
     }
 
     if ( reback ){
         cSprite.applyBG();
         cSprite.__LZbgRef.menu = menu;
+        cSprite.__LZbgRef._alpha = al;
     }
     return true;
 }
@@ -1548,16 +1558,15 @@
       }
     }
 
-    var mc = this.getMCRef();
     // [todo hqm 01-24-07] SWF-specific 
     var mb = this.__LZbgRef;
-    // If there's no movieclip attached, use the background clip.
-    if (mc != null) {
-        mc.menu = cmenu;
+    if (mb == null) {
+        this.setBGColor(0xffffff);
+        var mb = this.__LZbgRef;
+        mb._alpha = 0;
     }
-    if (mb != null) {
-        mb.menu = cmenu;
-    }
+    this._bgcolorhidden = true;
+    mb.menu = cmenu;
 
     if (mb == null && mc == null) {
       if ($debug) Debug.warn("LzView.setContextMenu: cannot set menu on view 
%w, it has no foreground or background movieclip", this.owner);


_______________________________________________
Laszlo-checkins mailing list
[email protected]
http://www.openlaszlo.org/mailman/listinfo/laszlo-checkins

Reply via email to