Comunidad de diseño web y desarrollo en internet online

problemilla con los enlace

Citar            
MensajeEscrito el 07 Oct 2008 10:45 pm
Hola soy nuevo en esto i tengo un problemilla nuse como agregar al codigo que tengo para que al darle un click encima de una imagen vaya a un enlace, ocea tengo el menu que carga la info de la bd (caption es lo del enlace) pero nuse como añadir eso .

Código :

//default iconsize 128
var iconSize = 128;
//load xml file
var xml:XML = new XML ();
xml.ignoreWhite = true;
xml.onLoad = function () {
   var nodes = this.firstChild.childNodes;
   numItems = nodes.length;
   var root = this.firstChild.attributes;
   iconSize = Number (root.iconsize);
   var xpos = Number (root.x);
   var ypos = Number (root.y);
   var hspace = Number (root.hspacing);
   var vspace = Number (root.vspacing);
   for (var i = 0; i < numItems; i++) {
      var t = _root.attachMovie ("mc.item", "item" + i, i + 1);
      t._x = xpos;
      t._y = ypos;
      xpos += iconSize + hspace;
      if (xpos > Stage.width - iconSize) {
         ypos += iconSize + vspace;
         xpos = Number(root.x);
      }
      var attr = nodes[i].attributes;
      loadPNG (t, attr.image);
      t.item.onRollOver = iconRollOver;
      t.item.onRollOut = iconRollOut;
      t.tooltip = attr.tooltip;
      t.content = attr.content;
   }
};
xml.load ("menu/cas.xml");
//functions
loadPNG = function (itemClip, imageFile) {
   itemClip.item.png.loadMovie (imageFile);
   itemClip.shade.png.loadMovie (imageFile);
   itemClip.reflection.png.loadMovie (imageFile);
   itemClip.item.pngglow.png.loadMovie (imageFile);
};


esto es lo que se tiene que añadir pero nuse como:

Código :

t.action = attr.action; 
item.onRelease = function() {
getURL(action, "_blank" );
}


Aver si alquine me exa un cable pq es bastante urgente.

Saludos

Por alex5o2

16 de clabLevel



Genero:Masculino  

firefox
Citar            
MensajeEscrito el 08 Oct 2008 06:45 am
Pero por todo lo bueno y santo que hay en el mundo ¿qué tienes contra el castellano? No tener que traducir lo que quieres decir ayudaría mucho a entender tu problema.

Por The Fricky!

Presidente

6168 de clabLevel

3 tutoriales
8 articulos

Genero:Masculino   Bastard Operators From Hell Héroes

Piccola Venezia...

firefox
Citar            
MensajeEscrito el 08 Oct 2008 06:57 am
Mira te explico quiero añadir el segundo codigo al primero. El funcionamiento del flash es el siquiete, es un menu con iconos que se cargan de un arxivo xml y yo lo que quiero cargar un enlace para cada este icone . (en el arxivo xml ya e creado action=¨http://www.......¨).
Y perdonar por el mensaje de arriba por no haberme explicado bien.


Saludos.

Por alex5o2

16 de clabLevel



Genero:Masculino  

msie7
Citar            
MensajeEscrito el 08 Oct 2008 09:18 am
Debajo de estas líneas

Código ActionScript :

t.item.onRollOver = iconRollOver;
t.item.onRollOut = iconRollOut;


Las cuales son las acciones de los objetos debes añadir el onRelease:

Código ActionScript :

t.action = attr.action;

t.item.onRelease = function():Void{

   getURL(this._parent.action, "_blank" );

}


Y la variable action si la sitúas dentro del clip "t" debes salir a buscarla ya que la acción está asignada a un movieClip que está dentro de este.

Por elchininet

Claber

3921 de clabLevel

17 tutoriales

Genero:Masculino  

Front-end developer at Booking.com

firefox
Citar            
MensajeEscrito el 08 Oct 2008 01:42 pm
Ocea asi estaria bien

Código :

//default iconsize 128
var iconSize = 128;
//load xml file
var xml:XML = new XML ();
xml.ignoreWhite = true;
xml.onLoad = function () {
   var nodes = this.firstChild.childNodes;
   numItems = nodes.length;
   var root = this.firstChild.attributes;
   iconSize = Number (root.iconsize);
   var xpos = Number (root.x);
   var ypos = Number (root.y);
   var hspace = Number (root.hspacing);
   var vspace = Number (root.vspacing);
   for (var i = 0; i < numItems; i++) {
      var t = _root.attachMovie ("mc.item", "item" + i, i + 1);
      t._x = xpos;
      t._y = ypos;
      xpos += iconSize + hspace;
      if (xpos > Stage.width - iconSize) {
         ypos += iconSize + vspace;
         xpos = Number(root.x);
      }
      var attr = nodes[i].attributes;
      loadPNG (t, attr.image);
      t.item.onRollOver = iconRollOver;
      t.item.onRollOut = iconRollOut;
      t.action = attr.action;  
      t.item.onRelease = function():Void{   
            getURL(this._parent.action, "_blank" );  } 
      t.tooltip = attr.tooltip;
      t.content = attr.content;
   }
};
xml.load ("menu/cas.xml");
//functions
loadPNG = function (itemClip, imageFile) {
   itemClip.item.png.loadMovie (imageFile);
   itemClip.shade.png.loadMovie (imageFile);
   itemClip.reflection.png.loadMovie (imageFile);
   itemClip.item.pngglow.png.loadMovie (imageFile);
};


y en el arxivo xml action="http://www.mysite.com"

repito soy nuevo en esto.

GRACIAS elchininet por tu respuesta.

Saludos

Por alex5o2

16 de clabLevel



Genero:Masculino  

msie7

 

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