Reloj analógico
Aquí os pongo el codigo que he hecho para mostrar la hora en un reloj analógico del pc que ejecuta el flash.
Código en el primer fotograma:
- function t() {
- d = new Date();
- m = d.getMinutes();
- h = d.getHours();
- s = d.getSeconds();
- }
- t();
Código de la aguja hora:
- onClipEvent (enterFrame) {
- t();
- if (_root.m<12) {
- this._rotation = _root.h*30;
- }
- if (_root.m>11 && _root.m<25) {
- this._rotation = _root.h*30+6;
- }
- if (_root.m>24 && _root.m<37) {
- this._rotation = _root.h*30+12;
- }
- if (_root.m>36 && _root.m<49) {
- this._rotation = _root.h*30+18;
- }
- if (_root.m>48 && _root.m<60) {
- this._rotation = _root.h*30+24;
- }
- }
Código de la aguja minuto:
- onClipEvent (enterFrame) {
- _root.t();
- this._rotation = _root.m*6;
- }
Código de la ajuga segundo:
- onClipEvent (enterFrame) {
- this._rotation = _root.s*6;
- }
This movie requires Flash Player 8
Add comment November 27th, 2006