Ver Mensaje Individual
  #3 (permalink)  
Antiguo 20/05/2010, 13:51
Avatar de Lynxcraft
Lynxcraft
 
Fecha de Ingreso: noviembre-2007
Ubicación: yecla murcia
Mensajes: 1.346
Antigüedad: 16 años, 5 meses
Puntos: 51
Respuesta: Evento mouse no funciona + animación durante tiempo determinado

puedes hacer algo parecido ha esto
Código PHP:
var keyLabel:Array=new Array("dado1","dado2","dado3","dado4","dado5","dado6")
var 
dado=new Dado();
addChild(dado);
dado.x=50;
dado.y=50;
var 
n:int=1
var timerStop:Timer=new Timer(1000*3,1)
timerStop.addEventListener(TimerEvent.TIMER,detectStopDado)
dado.stop()
dado.addEventListener(MouseEvent.CLICK,initTimerStopDado)
function 
initTimerStopDado(event:MouseEvent){
    
dado.removeEventListener(MouseEvent.CLICK,initTimerStopDado)
    
n=random()
    
dado.play()
    
timerStop.reset()
    
timerStop.start()
}
function 
detectStopDado(event:TimerEvent){
    
dado.addEventListener(Event.ENTER_FRAME,StopDado)
}
function 
StopDado(event:Event){
    if(
dado.currentFrameLabel==keyLabel[n]){
        
dado.stop()
        
dado.removeEventListener(Event.ENTER_FRAME,StopDado)
        
dado.addEventListener(MouseEvent.CLICK,initTimerStopDado)
    }
}
function 
random():int {
    return (
Math.round(Math.random()*5)==Math.round(Math.random()*5))?Math.round(Math.random()*5):Math.round(Math.random()*5);

ejemplo

http://crea-flash.com/index.php?opti...&id=5&Itemid=8
__________________
Sobran las ideas cuando faltan ganas de trabajar en ellas
Lynxcraft

Última edición por Lynxcraft; 20/05/2010 a las 18:54