Estoy haciendo una actividad en flash y el desorden empieza a ser preocupante. Os explico.
En el primer fotograma tengo el siguiente código:
Código :
var milesimasXcentecima:uint=10;
var milesimasXsegundo:uint=1000;
var milesimasXminuto:uint=1000 * 60;// 60,000
var milesimasXhora:uint=1000 * 60 * 60;// 3,600,000
var hora:uint;
var minuto:uint;
var segundo:uint;
var centesima:uint;
var hora_txt:String;
var minuto_txt:String;
var segundo_txt:String;
var centesima_txt:String;
var milesimasTranscurridas:uint;
var copiaDe_GetTimer:uint;
var referenciaTemporal:uint;
function tickTack(e:TimerEvent):void{
milesimasTranscurridas=getTimer() - copiaDe_GetTimer;
minuto=Math.floor(milesimasTranscurridas / milesimasXminuto);
referenciaTemporal=milesimasTranscurridas - minuto * milesimasXminuto;
segundo=Math.floor(referenciaTemporal / milesimasXsegundo);
referenciaTemporal=referenciaTemporal - segundo * milesimasXsegundo;
centesima=Math.floor(referenciaTemporal / milesimasXcentecima);
// Condicinales que hacen que todos los numeros tengan siempre dos digitos y no uno
if (minuto < 10) {
minuto_txt="0" + minuto.toString();
} else {
minuto_txt=minuto.toString();
}
if (segundo < 10) {
segundo_txt="0" + segundo.toString();
} else {
segundo_txt=segundo.toString();
}
if (centesima < 10) {
centesima_txt="0" + centesima.toString();
} else {
centesima_txt=centesima.toString();
}
// Pasanos todo al campo de texto
led_txt.text=minuto_txt + " : " + segundo_txt + " : " + centesima_txt;
}
function IniciarCrono():void{
var temporizador:Timer=new Timer(10,0);
temporizador.addEventListener(TimerEvent.TIMER, tickTack);
copiaDe_GetTimer=getTimer();
temporizador.start();
};
function CambiarColor(myobj:MovieClip, mycolor:Number) {
var newColorTransform:ColorTransform = myobj.transform.colorTransform;
newColorTransform.color = mycolor;
myobj.transform.colorTransform = newColorTransform;
};
function NumeroAzar (max:Number, min:Number, decimales:Number):Number {
var maxConDecimales = max*(Math.pow (10, decimales));
var minConDecimales = min*(Math.pow (10, decimales));
return (Math.floor(Math.random() * (maxConDecimales - minConDecimales + 1)) + minConDecimales) / Math.pow (10, decimales);
};y en el número 11 llamo a las funciones del primer fotograma:
¿Cómo podría hacer para declarar las variables y las funciones en un archivo .as y llamarlas desde el proyecto?
Lo he intentado varias veces pero sin mucho éxito. Me devuelve errores por no estar declarada las variables y las funciones, o algún objeto,...
Muchas gracias a todos!
