3dnirvana is best viewed in Mozilla Firefox 2.0!! The multi browser program for this blog is under development. Wish you all a very happy navigation.

3dnirvana doesn't take any authority over its content. Viewers are free to comment, review and analyze anything under personal right to freedom.

3dnirvana is the creative face of Roshan Kolar, who is a Creative Engineer and an Animator.

A VERY GOOD AND HANDY TIMER CODE FOR FLASH 8 DEVELOPERS!!



//initial variables
var timing:Boolean = false;
var paused:Boolean = false;
var remaining:Number;
var elapsedTime:Number;
var elapsedHours:Number;
var elapsedM:Number;
var elapsedS:Number;
var elapsedH:Number;
var startTime:Number;
var remaining:Number;
var hours:String;
var minutes:String;
var seconds:String;
var hundredths:String;

if (!_root.timing) {
if (_root.paused) {
_root.startTime = getTimer()-_root.elapsedTime;
} else {
_root.startTime = getTimer();
}
//start timer
_root.paused = false;
_root.timing = true;
}
_root.onEnterFrame = function() {
if (timing) {
//calculate values
elapsedTime = getTimer()-startTime;
//hours
elapsedHours = Math.floor(elapsedTime/3600000);
remaining = elapsedTime-(elapsedHours*3600000);
//minutes
elapsedM = Math.floor(remaining/60000);
remaining = remaining-(elapsedM*60000);
//seconds
elapsedS = Math.floor(remaining/1000);
remaining = remaining-(elapsedS*1000);
//hundredths
elapsedH = Math.floor(remaining/10);
//output to text box
//add a 0 on the front of the numbers if the number is less than 10
if (elapsedHours<10) {
hours = "0"+elapsedHours.toString();
} else {
hours = elapsedHours.toString();
}
if (elapsedM<10) {
minutes = "0"+elapsedM.toString();
} else {
minutes = elapsedM.toString();
}
if (elapsedS<10) {
seconds = "0"+elapsedS.toString();
} else {
seconds = elapsedS.toString();
}
if (elapsedH<10) {
hundredths = "0"+elapsedH.toString();
} else {
hundredths = elapsedH.toString();
}
_root.timer_txt = hours+":"+minutes+":"+seconds+":"+hundredths;
}
};
time.onRelease=function(){
stop();
mytimer = hours+":"+minutes+":"+seconds+":"+hundredths;
};


Dont forget to put the button and the text field with respective instance names!!

2 comments:

Anonymous said...

Well said.

Anonymous said...

Sіmрly want to sау уour article is as surprisіng.
The clarity on your ѕubmit is simply gгeat
and i can suppοsе уou are an expeгt in thiѕ subјect.
Well together with your peгmission let me to snatch your fееd tο ѕtay up to ԁate wіth aρproachіng post.
Thanκ you one million and pleаse continuе the rewarding work.


Also visit my webρage: green coffee bean max walmart