You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by lu...@apache.org on 2009/06/11 01:43:53 UTC

svn commit: r783573 - /myfaces/tomahawk/trunk/sandbox/core/src/main/resources/org/apache/myfaces/custom/imageloop/resource/javascript/imageloop.js

Author: lu4242
Date: Wed Jun 10 23:43:53 2009
New Revision: 783573

URL: http://svn.apache.org/viewvc?rev=783573&view=rev
Log:
TOMAHAWK-1424 Patch for Sandbox ImageLoop - Flickering to old images after loading new image set (Thanks to Matthias Gerber)

Modified:
    myfaces/tomahawk/trunk/sandbox/core/src/main/resources/org/apache/myfaces/custom/imageloop/resource/javascript/imageloop.js

Modified: myfaces/tomahawk/trunk/sandbox/core/src/main/resources/org/apache/myfaces/custom/imageloop/resource/javascript/imageloop.js
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/sandbox/core/src/main/resources/org/apache/myfaces/custom/imageloop/resource/javascript/imageloop.js?rev=783573&r1=783572&r2=783573&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/sandbox/core/src/main/resources/org/apache/myfaces/custom/imageloop/resource/javascript/imageloop.js (original)
+++ myfaces/tomahawk/trunk/sandbox/core/src/main/resources/org/apache/myfaces/custom/imageloop/resource/javascript/imageloop.js Wed Jun 10 23:43:53 2009
@@ -86,7 +86,7 @@
         this._timer = null;
     }
 }
-    
+
 ImageLoop.prototype.forward = function() {
     if (this._numImagesLoaded === this._images.length && this._images.length > 1) {
         this.stop();
@@ -162,7 +162,13 @@
         dojo.debug("Finished loading: " + this._numImagesLoaded + " images loaded.");
         // Set index to last image. Loop will start with first image.
         this._index = this._images.length - 1;
-        this.start();
+        if(imageLoops[this._clientId] === this){
+            // Only start the image loop, when the instance is still active.
+            // Otherwise, an old, inactive instance can interfere with the current active one.
+            // Happens, when new imageloop instances, containing new pictures, are created before 
+            // images are preloaded.
+            this.start();
+        }
     }
 }