Ver Mensaje Individual
  #2 (permalink)  
Antiguo 13/11/2007, 18:34
Avatar de TMeister
TMeister
Crazy Coder
 
Fecha de Ingreso: enero-2002
Ubicación: En la Oficina
Mensajes: 2.880
Antigüedad: 22 años, 3 meses
Puntos: 193
Re: nevigateToURL, de flas 9 y AS3

prueba esto:

Código:
var box:MovieClip = new MovieClip();
function createBox()
{
	box.graphics.beginFill(0xcccccc);
	box.graphics.lineStyle(1, 0x000000);
	box.graphics.drawRect(0, 0, 50, 25);
	box.graphics.endFill();
	box.x = 10
	box.y = 10
	box.buttonMode = true
	box.addEventListener(MouseEvent.CLICK, goURL);
	addChild(box);
}
function goURL(e:Event)
{
	var url:String = "http://forosdelweb.com";
	var request:URLRequest = new URLRequest(url);
	try 
	{            
		navigateToURL(request);
	}
	catch (e:Error) 
	{
		trace("No se pudo lanzar la URL")
		trace(e)
	}

}
createBox()
Si no quieres usar try & catch trata esto

Código:
var box:MovieClip = new MovieClip();
function createBox()
{
	box.graphics.beginFill(0xcccccc);
	box.graphics.lineStyle(1, 0x000000);
	box.graphics.drawRect(0, 0, 50, 25);
	box.graphics.endFill();
	box.x = 10
	box.y = 10
	box.buttonMode = true
	box.addEventListener(MouseEvent.CLICK, goURL);
	addChild(box);
}
function goURL(e:Event)
{
	var url:String = "http://forosdelweb.com";
	var request:URLRequest = new URLRequest(url);
	navigateToURL(request);
}
createBox()
Saludos!!