anzi
queswto sulla frame
codice:
// Cronografo Tachimetro con Timer Rattrappante
// Cambio manuale ore
// Cambio manuale Minuti+Ore
// Cambio Manuale Data
// Reset Ore, Minuti, Data
// Timer con Start, Pause, Intertempo, Stop
// Grafica e Script Rempox = forum@rempox.it
cambia_ora=0
cambia_minuti=0
cambia_giorno=0
my_data = new Date();
giorno = my_data.getDate()
// Gestione TIMER
init();
play_btn.onPress = function() {
play_btn.gotoAndStop(1+paused);
paused = !paused;
if (paused) {
_parent.onEnterFrame = updateTimer;
startTime = getTimer()-elapsedTime;
} else {
_parent.onEnterFrame = updateTimer;
startTime = getTimer()-elapsedTime;
}
};
stop_btn.onPress = function() {
init();
};
ora_btn.onPress = function() {
cambia_ora++
};
min_btn.onPress = function() {
cambia_minuti++
};
day_btn.onPress = function(){
if(giorno<31){giorno++}else{giorno=1}
}
reset_btn.onPress=function(){
cambia_ora=0
cambia_minuti=0
giorno = my_data.getDate()
}
function init() {
h._rotation = 0;
m._rotation = 0;
s._rotation = 0;
f._rotation = 0;
elapsedTime = 0;
_parent.onEnterFrame = null;
paused = true;
play_btn.gotoAndStop(1);
}
function updateTimer() {
elapsedTime = getTimer()-startTime;
// ore
var elapsedH = Math.floor(elapsedTime/3600000);
var remaining = elapsedTime-(elapsedH*3600000);
// minuti
var elapsedM = Math.floor(remaining/60000);
// secondi
var elapsedS = Math.floor(remaining/1000);
remaining = remainig-(elapsedS*1000);
// *centesimi
var elapsedFraction = Math.floor(remaining/10);
if(!paused){rotation(elapsedH,elapsedM,elapsedS)}
}
rotation = function(elapsedH,elapsedM,elapsedS){
// crea la rotazione
h._rotation = elapsedH*30;
m._rotation = elapsedM*6;
s._rotation = elapsedS*6;
// f._rotation=elapsedFraction*3.6
// f._rotation=Math.round(elapsedFraction/10)*36
f._rotation = Math.round(elapsedFraction*.12)*30;
}
e questo su un clip di comodo chiamato motore
codice:
// Lancette ora minuti secondi
onClipEvent(enterFrame){
_parent.Datacorrente = new Date();
_parent.ore._rotation = _parent.Datacorrente.getHours()*30+(_parent.Datacorrente.getMinutes()/2+_parent.cambia_minuti/2)+_parent.cambia_ora*30
_parent.minuti._rotation = _parent.Datacorrente.getMinutes()*6+(_parent.Datacorrente.getSeconds()/10)+_parent.cambia_minuti*6
_parent.secondi._rotation = _parent.Datacorrente.getSeconds()*6;
}
a questo punto basta che disegni le lancette e le chiami
ore, minuti, secondi
+ semplice di così non saprei
Rempox