00:00
00:00
B1KMusic
Hi. I make games and software. I'm not on NG much, but feel free to peruse my youtube and gitlab for interesting stuff.

Braden @B1KMusic

Age 29, Male

Programmer/Musician/

fish

Earth, Milky Way

Joined on 6/19/11

Level:
10
Exp Points:
948 / 1,110
Exp Rank:
69,535
Vote Power:
5.20 votes
Rank:
Police Sergeant
Global Rank:
8,627
Blams:
42
Saves:
1,040
B/P Bonus:
12%
Whistle:
Normal
Medals:
799

Digital clock

Posted by B1KMusic - August 18th, 2011


the following script is the code I used to make this, a working digital flash clock :D

The process was actually very tedious, as I had to make a condition for all 60 minutes and all 24 hours of the day. I drew, coded, and designed everything in this thing, so enjoy :D

//init
n1.gotoAndStop("n8");
n2.gotoAndStop("n8");
n3.gotoAndStop("n8");
n4.gotoAndStop("n8");
//end init
onEnterFrame = function () {
now = new Date();
h = now.getHours();
m = now.getMinutes();
//hours
if (h == 0 || h == 12) {
n1.gotoAndStop("n1");
n2.gotoAndStop("n2");
} else if (h == 1 || h == 13) {
n1.gotoAndStop("n0");
n2.gotoAndStop("n1");
} else if (h == 2 || h == 14) {
n1.gotoAndStop("n0");
n2.gotoAndStop("n2");
} else if (h == 3 || h == 15) {
n1.gotoAndStop("n0");
n2.gotoAndStop("n3");
} else if (h == 4 || h == 16) {
n1.gotoAndStop('n0');
n2.gotoAndStop('n4');
} else if (h == 5 || h == 17) {
n1.gotoAndStop('n0');
n2.gotoAndStop('n5');
} else if (h == 6 || h == 18) {
n1.gotoAndStop('n0');
n2.gotoAndStop('n6');
} else if (h == 7 || h == 19) {
n1.gotoAndStop('n0');
n2.gotoAndStop('n7');
} else if (h == 8 || h == 20) {
n1.gotoAndStop('n0');
n2.gotoAndStop('n8');
} else if (h == 9 || h == 21) {
n1.gotoAndStop('n0');
n2.gotoAndStop('n9');
} else if (h == 10 || h == 22) {
n1.gotoAndStop('n1');
n2.gotoAndStop('n0');
} else if (h == 11 || h == 23) {
n1.gotoAndStop('n1');
n2.gotoAndStop('n1');
}
//minutes
//tens
if (m<10) {
n3.gotoAndStop('n0');
} else if (m<20) {
n3.gotoAndStop('n1');
} else if (m<30) {
n3.gotoAndStop('n2');
} else if (m<40) {
n3.gotoAndStop('n3');
} else if (m<50) {
n3.gotoAndStop('n4');
} else {
n3.gotoAndStop('n5');
}
function mn(t) {
//mn = MiNutes
//t = time
n4.gotoAndStop(t);
}
//ones
if (m == 0 || m == 10 || m == 20 || m == 30 || m == 40 || m == 50) {
mn('n0');
} else if (m == 1 || m == 11 || m == 21 || m == 31 || m == 41 || m == 51) {
mn('n1');
} else if (m == 2 || m == 12 || m == 22 || m == 32 || m == 42 || m == 52) {
mn('n2');
} else if (m == 3 || m == 13 || m == 23 || m == 33 || m == 43 || m == 53) {
mn('n3');
} else if (m == 4 || m == 14 || m == 24 || m == 34 || m == 44 || m == 54) {
mn('n4');
} else if (m == 5 || m == 15 || m == 25 || m == 35 || m == 45 || m == 55) {
mn('n5');
} else if (m == 6 || m == 16 || m == 26 || m == 36 || m == 46 || m == 56) {
mn('n6');
} else if (m == 7 || m == 17 || m == 27 || m == 37 || m == 47 || m == 57) {
mn('n7');
} else if (m == 8 || m == 18 || m == 28 || m == 38 || m == 48 || m == 58) {
mn('n8');
} else if (m == 9 || m == 19 || m == 29 || m == 39 || m == 49 || m == 59) {
mn('n9');
}
};

If you want the FLA, just make a comment saying so :D

If this isn't the ULTIMATE proof that Flash 8 and actionscript 2 are object oriented, I don't know what is.

Digital clock


Comments

Comments ain't a thing here.