Comunidad de diseño web y desarrollo en internet online

Botonera Con as3

Citar            
MensajeEscrito el 18 Mar 2015 01:48 am
Que tal buenas tardes:

Quisiera pedir su apoyo, con el fin de que me ayuden.
Estoy tratando de hacer una botonera en as3 para un proyecto que se me encargo, her realizado los botones y el texto que va en los botones, sin embargo a la hora de ponerles los links, estos no funcionan.

El código que he hecho es el siguiente:

var nombresBotones:Array = new Array ("GOOGLE", "YAHOO", "HOTMAIL", "INTERC", "CRISTALAB");
var direccionesWeb:Array = new Array ("http://www.google.com.mx", "http://www.yahoo.com.mx", "http://www.hotmail.com", "http://www.intercambiosvirtuales.org","http://www.cristalab.com");
for (var i = 0; i<5; i++){

var button:Sprite = new Sprite();
button.graphics.beginFill(0xff0066, 0.5);
button.graphics.drawRect(0, 0, 70, 25);
button.graphics.endFill();
button.x = i * 80;
button.y = 30;

var str:String = nombresBotones[i];
var fontDescription:FontDescription = new FontDescription("Arial","normal");
var format:ElementFormat = new ElementFormat(fontDescription, 14, 0x000000, 1);
var textElement:TextElement = new TextElement(str.toUpperCase(), format);
var textBlock:TextBlock = new TextBlock();
textBlock.content = textElement;
textBlock.baselineZero = TextBaseline.ROMAN;
var textLine:TextLine = textBlock.createTextLine(null, 300);
textLine.x = 5;
textLine.y = textLine.height+5;


button.buttonMode = true;
addChild (button);
button.addChild(textLine);

}

button[i].addEventListener(MouseEvent.CLICK, presionado);

function presionado (e:MouseEvent):void{
var webs:URLRequest = new URLRequest(e.target.url);
navigateToURL(webs);
//buttonsContainer.addChild(button);
}


Quisiera que alguno de ustedes me pudiesen ayudar, he tratado de hacerlo por una semana y no se me ocurre nada, por favor.

espero su respuesta

PD. los links que aqui puse son ejemplos.

Por elpuma09

1 de clabLevel



 

firefox
Citar            
MensajeEscrito el 20 Mar 2015 06:23 pm
Estas muy verde.. aqui tienes el trabajo echo

Suerte

Código ActionScript :

var nombresBotones:Array = new Array("GOOGLE","YAHOO","HOTMAIL","INTERC","CRISTALAB");
var direccionesWeb:Array = new Array("http://www.google.com.mx","http://www.yahoo.com.mx","http://www.hotmail.com","http://www.intercambiosvirtuales.org","http://www.cristalab.com");


function startMenu():void {

   for (var i:int = 0; i<5; i++) {

      var button:MovieClip = new MovieClip();
      button.graphics.beginFill(0xff0066, 0.5);
      button.graphics.drawRect(0, 0, 70, 25);
      button.graphics.endFill();
      button.x = i * 80;
      button.y = 30;

      var textBlock:TextBlock = new TextBlock();
      textBlock.content = new TextElement(nombresBotones[i].toUpperCase(),new ElementFormat(new FontDescription("Arial","normal"),14,0x000000,1));
      textBlock.baselineZero = TextBaseline.ROMAN;
      var textLine:TextLine = textBlock.createTextLine(null,300);
      textLine.x = 5;
      textLine.y = textLine.height + 5;

      button.buttonMode = true;
      addChild(button);
      button.addChild(textLine);
      button.miurl = direccionesWeb[i];
      button.addEventListener(MouseEvent.CLICK, onButtonPress);

   }
}

startMenu();

function onButtonPress(e:Event):void {
   navigateToURL(new URLRequest(e.currentTarget.miurl));
}

Por giskard

110 de clabLevel



Genero:Masculino  

Programador y diseñador web

firefox

 

Cristalab BabyBlue v4 + V4 © 2011 Cristalab
Powered by ClabEngines v4, HTML5, love and ponies.