Reloj analógico
November 27th, 2006
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
Entry Filed under: ActionScript
Leave a Comment
Some HTML allowed:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>
Trackback this post | Subscribe to the comments via RSS Feed