My scrolling counter is not displaying 1-9...only “zeros” every ten intervals. It plays, but the code is unfinished at line 37 in NumbersView.as. Notice Tweener is used to display the sprites. How do I finish this?
WHAT I'M TESTING "NumbersView.as"
loop error, onComplete, missing argument or function
- Tweener code, line 37?
- for loop, line 22? for (var i:Number = 0; i < 9; i++)
Thanks for the help!
numbers.fla
NumbersView.as "see Tweener part towards the bottom"
package
{
import flash.display.DisplayObject;
import flash.display.MovieClip;
import flash.utils.Dictionary;
import flash.events.Event;
import caurina.transitions.Tweener;
public class NumbersView extends MovieClip
{
private var _listItems:Array = new Array();
public function NumbersView()
{
var item:NumberImage;
for (var i:Number = 0; i < 9; i++) {
item = new NumberImage();
addChild(item);
item.x = i * item.width;
_listItems.push(item);
}
}
public function setTime($number:String):void {
var nums:Array = $number.split("");
for (var i:Number = 0; i < nums.length; i++) {
if (int(nums[i]) == 0) {
Tweener.removeTweens(_listItems[i].moveableNumber_mc);
if (_listItems[i].moveableNumber_mc.y < 0) {
_listItems[i].moveableNumber_mc.y = 120;
}
Tweener.addTween(_listItems[i].moveableNumber_mc, { y: 0, time:.3 } );
} else {
Tweener.addTween(_listItems[i].moveableNumber_mc, { y: -120 * int(nums[i]), time:.3} );
}
}
}
}
}
NumberDocumentClass.as "works fine"
package {
import flash.display.Sprite;
import flash.utils.Timer;
import flash.events.TimerEvent;
public class NumberDocumentClass extends Sprite {
private var timer:Timer = new Timer(10);
private var count:int = 0;
private var fcount:int = 0;
private var numbers:NumbersView;
public function NumberDocumentClass() {
timer.addEventListener(TimerEvent.TIMER, incrementCounter);
timer.start();
numbers = new NumbersView();
addChild(numbers);
}
function incrementCounter(event:TimerEvent) {
count++;
fcount=int(count*count/1000);//starts out slow... then speeds up
numbers.setTime(formatCount(fcount));
}
function formatCount(i:int):String {
return ("000000000" + i).substr(-9, 9);
}
}
}
I got it debugged!