[Laszlo-checkins] r13841 - openlaszlo/trunk/WEB-INF/lps/lfc/controllers

bargull@openlaszlo.org bargull at openlaszlo.org
Fri May 8 15:08:03 PDT 2009


Author: bargull
Date: 2009-05-08 15:08:01 -0700 (Fri, 08 May 2009)
New Revision: 13841

Modified:
   openlaszlo/trunk/WEB-INF/lps/lfc/controllers/LaszloAnimation.lzs
Log:
Change 20090508-bargull-QAO by bargull at dell--p4--2-53 on 2009-05-08 20:09:33
    in /home/Admin/src/svn/openlaszlo/trunk
    for http://svn.openlaszlo.org/openlaszlo/trunk

Summary: animator bug due to implicit coercion

New Features:

Bugs Fixed: LPP-8172 ('empty' animators do not run in swf9)

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

Documentation:

Release Notes:

Details:
Empty animators caused a subtle bug in swf9 because of implicit coercion in swf9:
In swf9, 'undefined' can only be used for the any-type ('*'), for any other type 'undefined' is coerced to 'null'. This is a problem if you intend to use strict typing, but then forget some casts. In this case, the "attribute"-property was casted to String in some methods, but in several methods it wasn't. And if you later use string concatenation (here: "e_" + attribute), you may get "e_null" (coerced) or "e_undefined" (not coerced).

    

Tests:
testcase from bugreport



Modified: openlaszlo/trunk/WEB-INF/lps/lfc/controllers/LaszloAnimation.lzs
===================================================================
--- openlaszlo/trunk/WEB-INF/lps/lfc/controllers/LaszloAnimation.lzs	2009-05-08 21:21:26 UTC (rev 13840)
+++ openlaszlo/trunk/WEB-INF/lps/lfc/controllers/LaszloAnimation.lzs	2009-05-08 22:08:01 UTC (rev 13841)
@@ -1,7 +1,7 @@
 /**
   * LaszloAnimations.as
   *
-  * @copyright Copyright 2001-2008 Laszlo Systems, Inc.  All Rights Reserved.
+  * @copyright Copyright 2001-2009 Laszlo Systems, Inc.  All Rights Reserved.
   *            Use is subject to license terms.
   * @affects animation lzanimator
   * @access public
@@ -288,7 +288,7 @@
         if (! this.isactive) return;
 
         var targ:LzNode = this.target;
-        var e_prop:String = "e_" + this.attribute;
+        var e_prop:String = "e_" + (this.attribute cast String);
         if (! targ[e_prop].c) {
             targ[e_prop].c = 0;
         }
@@ -308,14 +308,15 @@
       */
     override function __LZfinalizeAnim () :void {
         var targ:LzNode = this.target;
-        var e_prop:String = "e_" + this.attribute;
+        var attr:String = this.attribute;
+        var e_prop:String = "e_" + attr;
         if (! targ[e_prop].c) {
             targ[e_prop].c = 0;
         }
         targ[e_prop].c -= 1; //decrement animation counter for prop
         if (targ[e_prop].c <= 0) {
             targ[e_prop].c = 0;
-            targ.setAttribute(this.attribute, targ[e_prop].v);
+            targ.setAttribute(attr, targ[e_prop].v);
             targ[e_prop].v = null;
         }
 
@@ -410,8 +411,9 @@
         // All animators are now relative at the core so add the difference
         // of this value - the current value to the view's attribute.
         var targ:LzNode = this.target;
+        var attr:String = this.attribute;
         var aDiff:Number = value - this.currentValue;
-        targ.setAttribute(this.attribute, targ[this.attribute] + aDiff);
+        targ.setAttribute(attr, targ[attr] + aDiff);
         this.currentValue = value;
     }
 



More information about the Laszlo-checkins mailing list