Ver Mensaje Individual
  #13 (permalink)  
Antiguo 29/06/2010, 05:37
Avatar de andmai
andmai
 
Fecha de Ingreso: enero-2010
Mensajes: 84
Antigüedad: 14 años, 3 meses
Puntos: 1
Respuesta: Evento mouse no funciona + animación durante tiempo determinado

Gracias por tu respuesta, pero sigue sin salirme....

Tengo la clase .as tal y como tu me pusiste


Código:
package { 
    import flash.display.MovieClip; 
    import flash.events.MouseEvent; 
    import flash.events.TimerEvent 
    import flash.utils.Timer 
    import flash.events.Event 
    public dynamic class DiceCluedo extends MovieClip { 
        public var n:int=0; 
        public var keyFrames:Array=new Array("dado1","dado2","dado3","dado4","dado5","dado6"); 
        public var mcDado:MovieClip; 
        public var MinSegundos:Number=3;//este es el tiempo minimo de animacion del dado el tiempo maximo dependera de los frames que tenga la animacion 
        public var timerStop:Timer; 
        public var functionEnd:Function=function(n:int):void{}; 
        public var functionEndParam:Array=new Array(); 
        public function DiceCluedo(func:Function=null,param:Array=null):void { 
            functionEnd=(func!=null)?func:functionEnd; 
            functionEndParam=(param)?param:functionEndParam; 
            mcDado= dadoC;//este Movie deve estar vinculado en la biblioteca y tienes que tener los keyFrames y guales a los de arriba  
            addChild(mcDado); 
            timerStop=new Timer(1000*MinSegundos,1); 
            timerStop.addEventListener(TimerEvent.TIMER,detectStopDado); 
            mcDado.stop(); 
        } 
        public function start():void { 
            initTimerStopDado(); 
        } 
        public function addFunction(func:Function):void { 
            functionEnd=func; 
        } 
        public function addFunctionParam(param:Array):void { 
            functionEndParam=param; 
        } 
        public function getValor():int { 
            return n+1; 
        } 
        private function initTimerStopDado() { 
            n=random(); 
            mcDado.play(); 
            timerStop.reset(); 
            timerStop.start(); 
        } 
        private function detectStopDado(event:TimerEvent) { 
            mcDado.addEventListener(Event.ENTER_FRAME,StopDado); 
        } 
        private function StopDado(event:Event) { 
            if (mcDado.currentFrameLabel==keyFrames[n]) { 
                mcDado.stop(); 
                mcDado.removeEventListener(Event.ENTER_FRAME,StopDado); 
                var paramTemp:Array=functionEndParam.slice() 
                paramTemp.unshift(getValor()); 
                functionEnd.apply(functionEnd,paramTemp) 
            } 
        } 
        private function random():int { 
            return (Math.round(Math.random()*5)==Math.round(Math.random()*5))?Math.round(Math.random()*5):Math.round(Math.random()*5); 
        } 

    } 
}
Pero me sigue dadndo error aqui

Código:
   mcDado= dadoC;
dadoC es el movieclip que tengo en la biblioteca en el .fla

¿por que me puede estar dadno este error?
gracias