Substrings, timer and LED lights, as3

Posted by VideoDnd on Stack Overflow See other posts from Stack Overflow or by VideoDnd
Published on 2010-04-30T21:40:15Z Indexed on 2010/04/30 21:47 UTC
Read the original article Hit count: 276

Filed under:
|

How would I sync my timer with my LED lights? I don't understand how to to set up the strings and conditions, so that they are unique to each number space.

Need a condition and values for each blinker

var condition:Number = 5;
if(condition==5){
blink.visible = !blink.visible;
//blink_.visible = !box.visible;
//blink__.visible = !box.visible;
}
}

alt text

Complete code

//MY TIMER
var timer:Timer = new Timer(100);
//INTEGER VALUES
var count:int = 0;
var fcount:int = 0; 
var oldcount:int = 0;
//FORMATTING STRING
function formatCount(i:int):String { 
var fraction:int = i % 100; 
var whole:int = i / 100;  
return ("00" + whole).substr(-2, 2) + "." + (fraction < 10 ? "0" + fraction : fraction); 
} 
//START TIMER
timer.start();
timer.addEventListener(TimerEvent.TIMER, condition);
//ANIMATION
function condition(event:TimerEvent):void{
count++;
fcount=int(count)
var toText:String = formatCount(fcount);
dec.text = toText.substr(4, 1);
decimal.text = toText.substr(3, 1);
ones.text = toText.substr(1, 1);
//LED LIGHTS
var condition:Number = 5;
if(condition==5){
blink.visible = !blink.visible;
//blink_.visible = !box.visible;
//blink__.visible = !box.visible;
}
}

© Stack Overflow or respective owner

Related posts about flash

Related posts about actionscript-3