ux/FlipCounter.js
[roojs1] / ux / FlipCounter.js
index ef18bc4..c9a1ed9 100644 (file)
@@ -2,7 +2,9 @@
 
 Roo.ux.FlipCounter = function(options)
 {
-    Roo.apply(this, options);
+    Roo.ux.FlipCounter.superclass.constructor.call(this, options);
+    
+    //Roo.apply(this, options);
     //this.el = $(element);
     //this.options = $.extend({}, defaults, options);
     this.addEvents({
@@ -67,10 +69,10 @@ Roo.extend(Roo.ux.FlipCounter, Roo.bootstrap.Component, {
          
         
         
-        var digit = new Roo.ux.FlipCounter.Digit({ manager : this, currentnumber : num });
+        var digit = new Roo.ux.FlipCounter.Digit({ manager : this, currentNumber : num });
         digit.manager = this;
         this.digits.push(digit);
-        digit.render(this.el);
+        digit.render(this.el, 0);
          
         // Update width
         this.ulWidth = this.ulWidth + digit.el.getWidth(true);
@@ -146,13 +148,22 @@ Roo.extend(Roo.ux.FlipCounter, Roo.bootstrap.Component, {
 Roo.ux.FlipCounter.Digit = function(options)
 {
     //Roo.apply(this, options);
+    Roo.ux.FlipCounter.Digit.superclass.constructor.call(this, options);
+
+    
+    this.currentNumber = parseInt(this.currentNumber);
+    
     
-    this.currentNumber = this.parseInt(this.currentNumber);
 }
 
 Roo.extend(Roo.ux.FlipCounter.Digit, Roo.bootstrap.Component, {
 
+    manager : null, // the flipcounter... 
     currentNumber : 0,
+    
+    
+    currentNum : 0,
+    nextNum : 0,
     targetNum : 0,
     
     topFrontDiv  : null,
@@ -163,6 +174,8 @@ Roo.extend(Roo.ux.FlipCounter.Digit, Roo.bootstrap.Component, {
     bottomNumFront : null,
     
     
+    
+    
     getAutoCreate : function(){
         
         return {
@@ -175,7 +188,7 @@ Roo.extend(Roo.ux.FlipCounter.Digit, Roo.bootstrap.Component, {
                             {
                                 cls : 'flipper_top flipper_top2 flipper_top_back',
                                 cn : [
-                                    { tag: 'span', html: num },
+                                    { tag: 'span', html: this.currentNumber },
                                     { cls : 'rings' }
                                 ]
                         
@@ -183,7 +196,7 @@ Roo.extend(Roo.ux.FlipCounter.Digit, Roo.bootstrap.Component, {
                             {
                                 cls : 'flipper_top flipper_top_front',
                                 cn : [
-                                    { tag: 'span', html: num },
+                                    { tag: 'span', html: this.currentNumber },
                                     { cls : 'rings' }
                                 ]
                         
@@ -194,14 +207,14 @@ Roo.extend(Roo.ux.FlipCounter.Digit, Roo.bootstrap.Component, {
                             {
                                 cls : 'flipper_bottom flipper_bottom1 flipper_bottom_back',
                                 cn : [
-                                    { tag: 'span', html: num },
+                                    { tag: 'span', html: this.currentNumber },
                                     { cls : 'rings' }
                                 ]
                             },
                             {
                                 cls : 'flipper_bottom flipper_bottom_front',
                                 cn : [
-                                    { tag: 'span', html: num },
+                                    { tag: 'span', html: this.currentNumber },
                                     { cls : 'rings' }
                                 ]
                             },
@@ -224,9 +237,9 @@ Roo.extend(Roo.ux.FlipCounter.Digit, Roo.bootstrap.Component, {
         this.bottomNumBack = this.el.select('.flipper_bottom_back span',true);
         this.bottomNumFront = this.el.select('.flipper_bottom_front span',true);
         
-        this.targetNum = currentNumber;
-        this.currentNum = currentNumber;
-        this.nextNum = currentNumber;
+        this.targetNum = this.currentNumber;
+        this.currentNum = this.currentNumber;
+        this.nextNum = this.currentNumber;
         
         this.currentlyAnimating = false;
     },