Action Script 2.0
DarkX [ dien20xx@gmail.com ]
draw 4 to start the clock needles (hour, minute, second and alarm). These they become Clip instance and we a1, a2, a3, a4, all in the same order. Of course! The reference point of the clip can not be focused when they believe the clip be sure to select a middle edge, otherwise the needle would do the same as a fan. After doing all that they believe the focus bezel and hands.
3 texts also create dynamic, one called "time" that will be worth the time and another 2 "alarmh" and "alarmm" These are to display the alarm.
Finally 4 buttons to control the alarm, give an instance where b1, b2, b3, b4.
Ahh, I forgot, imported or sound the alarm and within the library vincúlenlo for AS and put it "sounds."
Following all the steps we go to the Script. ===========================================
/ * declare the variables of the alarm (AS2 things) with initial value 0. We create a constructor for the Sound class and took a "sounds" of the library. * /
alarmh var = 0;
alarmm var = 0;
sounds = new Sound ();
soni.attachSound ("sounds");
/ * then the Date class to get * method returns a value of system time * /
onEnterFrame = function () {
time = new Date ();
tiempo.getSeconds sec = ();
tiempo.getMinutes min = ();
tiempo.getHours hor = ();
/ * initiation and movement of the needle is adjusted by multiplying by the number of angle, that is, being a full 360 degrees angle is divided by 60 giving a value of 6 degrees change minute and second, the time to be less taken for 30 * /
a1._rotation = sec * 6;
a2._rotation = min * 6;
a3._rotation = hor * 30;
/ * for math study is not going to burn a pair of neurons * /
a4._rotation = alarmh * 30 + alarmm / 2;
/ * The time to compare numbers * /
time = hor add ":" add min add ":" add sec;
/ * conditions for Tdinámicos do not leave place * /
if (alarmh> 24) {
alarmh = 0;
}
if (alarmh \u0026lt;0) {
alarmh = 24;
}
if (alarmm> 59) {
alarmm = 0;
}
if (alarmm \u0026lt;0) {
alarmm = 59;
}
/ * if the hour and minute alarm time coincide with the PC, play sound and reset the alarm * /
if (hor == == alarmh alarmm & & min) {
soni.start (0, 60);
alarmh = 0;
alarmm = 0;
}
};
/ * I put this so as not to repeat the sound if it becomes to set the alarm * /
onMouseUp = function () {
stopAllSounds ();
};
/ * buttons to set the alarm, they increase and decrease in "alarmh" and "alarmm",,, if they can put an input text to dynamic rather than less code * /
b1.onRelease = function () {
alarmh + +;
};
b2.onRelease = function () {
alarmh -;
};
b3.onRelease = function () {
alarmm + +;
};
b4.onRelease = function () {
alarmm -;
};
/ * hope you liked is any doubt throw the mail * /
0 comments:
Post a Comment