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

bargull@openlaszlo.org bargull at openlaszlo.org
Mon Mar 2 13:31:25 PST 2009


Author: bargull
Date: 2009-03-02 13:31:23 -0800 (Mon, 02 Mar 2009)
New Revision: 13124

Modified:
   openlaszlo/trunk/WEB-INF/lps/lfc/kernel/swf9/LzSprite.as
Log:
Change 20090302-bargull-e6N by bargull at dell--p4--2-53 on 2009-03-02 17:37:08
    in /home/Admin/src/svn/openlaszlo/trunk
    for http://svn.openlaszlo.org/openlaszlo/trunk

Summary: add invisible bgcolor for views without bgcolor

New Features:

Bugs Fixed: LPP-7842 (SWF9: context-menu not shown for view without bgcolor/content)

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

Documentation:

Release Notes:

Details:
If bgcolor isn't set, use an invisible background colour like in swf8. This forces the flash sprite to resize itself to match background fill size.
    

Tests:
testcase at bugreport



Modified: openlaszlo/trunk/WEB-INF/lps/lfc/kernel/swf9/LzSprite.as
===================================================================
--- openlaszlo/trunk/WEB-INF/lps/lfc/kernel/swf9/LzSprite.as	2009-03-02 21:26:46 UTC (rev 13123)
+++ openlaszlo/trunk/WEB-INF/lps/lfc/kernel/swf9/LzSprite.as	2009-03-02 21:31:23 UTC (rev 13124)
@@ -172,7 +172,8 @@
               this.graphics.clear();
           } else {
               this.graphics.clear();
-              this.graphics.beginFill(this.bgcolor);
+              var alpha:Number = this.__bgcolorhidden ? 0 : 1;
+              this.graphics.beginFill(this.bgcolor, alpha);
               this.graphics.drawRect(0, 0, this.lzwidth, this.lzheight);
               this.graphics.endFill();
           }
@@ -925,14 +926,21 @@
                                                              o.bb,
                                                              o.ab ? o.ab : 0);
       }
-      
+
       /** setBGColor( String/Number:color )
           o Sets the background color of the sprite
           o Can be a number (0xff00ff):void or a string ('#ff00ff'):void 
       */
       public function setBGColor( c:* ):void {
-          if (this.bgcolor == c) return;
-          this.bgcolor = c;
+          if (this.bgcolor == c && ! this.__bgcolorhidden) return;
+          if (c != null || this.__contextmenu == null) {
+              this.__bgcolorhidden = false;
+              this.bgcolor = c;
+          } else {
+              // create an invisible background
+              this.__bgcolorhidden = true;
+              this.bgcolor = 0xffffff;
+          }
           draw();
       }
 
@@ -1373,6 +1381,7 @@
       }
 
       var __contextmenu;
+      var __bgcolorhidden:Boolean = false;
 
       /* LzSprite.setContextMenu
        * Install menu items for the right-mouse-button 
@@ -1388,8 +1397,13 @@
               // 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.
+              if (this.bgcolor == null) {
+                  // if not present, create an invisible background
+                  this.__bgcolorhidden = true;
+                  this.bgcolor = 0xffffff;
+                  this.draw();
+              }
 
-
               // "contextMenu" is a swf9 property on flash.display.Sprite
               this.contextMenu = cmenu;
           }



More information about the Laszlo-checkins mailing list