Foros del Web » Creando para Internet » Flash y Actionscript »

Problema con ActionScript 3

Estas en el tema de Problema con ActionScript 3 en el foro de Flash y Actionscript en Foros del Web. Buenas a todos!!! Tengo una duda con la programacion ActionScript 3 mirar tengo este codigo en un clip de pelicula y me gustaria añadir un ...
  #1 (permalink)  
Antiguo 13/02/2009, 05:54
Avatar de estudio_vkd  
Fecha de Ingreso: octubre-2007
Ubicación: Valencia | España
Mensajes: 24
Antigüedad: 16 años, 5 meses
Puntos: 0
Exclamación Problema con ActionScript 3

Buenas a todos!!! Tengo una duda con la programacion ActionScript 3 mirar tengo este codigo en un clip de pelicula y me gustaria añadir un evento de click como si fuese un boton para que se redireccione a una URL. Porfavor si alguien sabe que me diga como y donde debo ponerlo (pero con lenguaje para tontos, que yo no entiendo, esto lo he aprendido con un tutorial)....Gracias de antemano!!!

Código:
package
{
	import flash.display.MovieClip;
	import flash.events.MouseEvent;
	import flash.events.Event;
	
	public class Boton_Blohg extends MovieClip
	{
		public function Boton_Blohg()
		{
			this.stop() ;
			this.buttonMode = true ;
			
			this.addEventListener (MouseEvent.ROLL_OVER, onRoll) ;
			this.addEventListener (MouseEvent.ROLL_OUT, onOut) ;
		}
		
		private function onRoll (event:MouseEvent) :void
		{
			this.removeEventListener ("enterFrame", onRetroceder)
			this.addEventListener (Event.ENTER_FRAME, onAvanzar) ;
		}
		
		private function onOut (event:MouseEvent) :void
		{
			this.removeEventListener ("enterFrame", onAvanzar)
			this.addEventListener (Event.ENTER_FRAME, onRetroceder) ;
		}
		
		private function onAvanzar (event:Event) :void
		{
			if (this.currentFrame < this.totalFrames) {
				this.nextFrame () ;
			
			}else{
				this.removeEventListener ("enterFrame", onAvanzar)
			}
		}
		
		private function onRetroceder (event:Event) :void
		{
			if (this.currentFrame > 1) {
				this.prevFrame () ;
			
			}else{
				this.removeEventListener ("enterFrame", onRetroceder)
			}
		}
	}
}
  #2 (permalink)  
Antiguo 13/02/2009, 06:06
Avatar de Lynxcraft  
Fecha de Ingreso: noviembre-2007
Ubicación: yecla murcia
Mensajes: 1.346
Antigüedad: 16 años, 4 meses
Puntos: 51
Respuesta: Problema con ActionScript 3

Código PHP:
package
{
    
import flash.display.MovieClip;
    
import flash.events.MouseEvent;
    
import flash.events.Event;
    
    public class 
Boton_Blohg extends MovieClip
    
{
        public function 
Boton_Blohg()
        {
            
this.stop() ;
            
this.buttonMode true ;
            
            
this.addEventListener (MouseEvent.ROLL_OVERonRoll) ;
            
this.addEventListener (MouseEvent.ROLL_OUTonOut) ;
            
this.addEventListener (MouseEvent.MOUSE_DOWN,onDown)
        }
        private function 
onDown (event:MouseEvent) :void
        
{
            
navigateToURL(new URLRequest("http://tuweb.com"),"_self");
        }
        
        private function 
onRoll (event:MouseEvent) :void
        
{
            
this.removeEventListener ("enterFrame"onRetroceder)
            
this.addEventListener (Event.ENTER_FRAMEonAvanzar) ;
        }
        
        private function 
onOut (event:MouseEvent) :void
        
{
            
this.removeEventListener ("enterFrame"onAvanzar)
            
this.addEventListener (Event.ENTER_FRAMEonRetroceder) ;
        }
        
        private function 
onAvanzar (event:Event) :void
        
{
            if (
this.currentFrame this.totalFrames) {
                
this.nextFrame () ;
            
            }else{
                
this.removeEventListener ("enterFrame"onAvanzar)
            }
        }
        
        private function 
onRetroceder (event:Event) :void
        
{
            if (
this.currentFrame 1) {
                
this.prevFrame () ;
            
            }else{
                
this.removeEventListener ("enterFrame"onRetroceder)
            }
        }
    }

__________________
Sobran las ideas cuando faltan ganas de trabajar en ellas
Lynxcraft
  #3 (permalink)  
Antiguo 13/02/2009, 06:48
Avatar de estudio_vkd  
Fecha de Ingreso: octubre-2007
Ubicación: Valencia | España
Mensajes: 24
Antigüedad: 16 años, 5 meses
Puntos: 0
Respuesta: Problema con ActionScript 3

muchas gracias por responder tan rapido, pero no funciona :( (me estoy volviendo loco, jejeje) al poner como me lo has puesto tu, omite los otros eventos y me da un error de compilacion en la linea 20 que es la de la URL. Eso es debido al error de esa linea y no continua leyendo la programacion?

errores:

1180: Call to a possibly undefined method navigateToURL.
1180: Call to a possibly undefined method URLRequest.
  #4 (permalink)  
Antiguo 13/02/2009, 07:47
Avatar de Lynxcraft  
Fecha de Ingreso: noviembre-2007
Ubicación: yecla murcia
Mensajes: 1.346
Antigüedad: 16 años, 4 meses
Puntos: 51
Respuesta: Problema con ActionScript 3

asi perdón me olvide de poner los paquetes
Código PHP:
package
{
    
import flash.display.MovieClip;
    
import flash.events.MouseEvent;
    
import flash.events.Event;
    
import flash.net.*
    
    public class 
Boton_Blohg extends MovieClip
    
{
        public function 
Boton_Blohg()
        {
            
this.stop() ;
            
this.buttonMode true ;
            
            
this.addEventListener (MouseEvent.ROLL_OVERonRoll) ;
            
this.addEventListener (MouseEvent.ROLL_OUTonOut) ;
            
this.addEventListener (MouseEvent.MOUSE_DOWN,onDown)
        }
        private function 
onDown (event:MouseEvent) :void
        
{
            
navigateToURL(new URLRequest("http://tuweb.com"),"_self");
        }
        
        private function 
onRoll (event:MouseEvent) :void
        
{
            
this.removeEventListener ("enterFrame"onRetroceder)
            
this.addEventListener (Event.ENTER_FRAMEonAvanzar) ;
        }
        
        private function 
onOut (event:MouseEvent) :void
        
{
            
this.removeEventListener ("enterFrame"onAvanzar)
            
this.addEventListener (Event.ENTER_FRAMEonRetroceder) ;
        }
        
        private function 
onAvanzar (event:Event) :void
        
{
            if (
this.currentFrame this.totalFrames) {
                
this.nextFrame () ;
            
            }else{
                
this.removeEventListener ("enterFrame"onAvanzar)
            }
        }
        
        private function 
onRetroceder (event:Event) :void
        
{
            if (
this.currentFrame 1) {
                
this.prevFrame () ;
            
            }else{
                
this.removeEventListener ("enterFrame"onRetroceder)
            }
        }
    }

__________________
Sobran las ideas cuando faltan ganas de trabajar en ellas
Lynxcraft
  #5 (permalink)  
Antiguo 23/02/2009, 02:11
Avatar de estudio_vkd  
Fecha de Ingreso: octubre-2007
Ubicación: Valencia | España
Mensajes: 24
Antigüedad: 16 años, 5 meses
Puntos: 0
Respuesta: Problema con ActionScript 3

Gracias, voy a probarlo ahora mismo y te digo, no lo he mirado antes que estaba de viaje!!
  #6 (permalink)  
Antiguo 23/02/2009, 02:18
Avatar de estudio_vkd  
Fecha de Ingreso: octubre-2007
Ubicación: Valencia | España
Mensajes: 24
Antigüedad: 16 años, 5 meses
Puntos: 0
Respuesta: Problema con ActionScript 3

Funciona a la perfeccion....Mil gracias!
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 04:56.