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

Asociar geturl a iconos cargados con xml

Estas en el tema de Asociar geturl a iconos cargados con xml en el foro de Flash y Actionscript en Foros del Web. Hola, resulta que tego un menu carrusel con unas fotos que se cargan desde un xml, pero no se como asignarle a cada uno la ...
  #1 (permalink)  
Antiguo 18/01/2009, 15:03
 
Fecha de Ingreso: junio-2008
Mensajes: 54
Antigüedad: 15 años, 10 meses
Puntos: 0
Asociar geturl a iconos cargados con xml

Hola, resulta que tego un menu carrusel con unas fotos que se cargan desde un xml, pero no se como asignarle a cada uno la funcion de "getUrl"

El codigo es este. A los iconos les llamo: icono1, icono2, etc. Lo que hace ahora es un trace con el tooltip que cada icono tiene en el .xml

Os agradeceria vuestra ayuda !! se poner funciones a botones normales pero así no tengo ni idea..

import mx.utils.Delegate;

var numOfItems:Number;
var radiusX:Number = 250;
var radiusY:Number = 75;
var centerX:Number = Stage.width / 2;
var centerY:Number = Stage.height / 2;
var speed:Number = 0.05;
var perspective:Number = 130;
var home:MovieClip = this;

var tooltip:MovieClip = this.attachMovie("tooltip","tooltip",10000);
tooltip._alpha = 0;

var xml:XML = new XML();
xml.ignoreWhite = true;

xml.onLoad = function()
{
var nodes = this.firstChild.childNodes;
numOfItems = nodes.length;
for(var i=0;i<numOfItems;i++)
{
var t = home.attachMovie("item","item"+i,i+1);
t.angle = i * ((Math.PI*2)/numOfItems);
t.onEnterFrame = mover;
t.toolText = nodes[i].attributes.tooltip;
t.icon.inner.loadMovie(nodes[i].attributes.image);
t.r.inner.loadMovie(nodes[i].attributes.image);
t.icon.onRollOver = over;
t.icon.onRollOut = out;
t.icon.onRelease = released;
}
}

function over()
{
home.tooltip.tipText.text = this._parent.toolText;
home.tooltip._x = this._parent._x;
home.tooltip._y = this._parent._y - this._parent._height/2;
home.tooltip.onEnterFrame = Delegate.create(this,moveTip);
home.tooltip._alpha = 100;
}

function out()
{
delete home.tooltip.onEnterFrame;
home.tooltip._alpha = 0;
}

function released()
{
trace(this._parent.toolText);
}

function moveTip()
{
home.tooltip._x = this._parent._x;
home.tooltip._y = this._parent._y - this._parent._height/2;
}

xml.load("icons.xml");

function mover()
{
this._x = Math.cos(this.angle) * radiusX + centerX;
this._y = Math.sin(this.angle) * radiusY + centerY;
var s = (this._y - perspective) /(centerY+radiusY-perspective);
this._xscale = this._yscale = s*100;
this.angle += this._parent.speed;
this.swapDepths(Math.round(this._xscale) + 100);
}

this.onMouseMove = function()
{
speed = (this._xmouse-centerX)/5000;
}
  #2 (permalink)  
Antiguo 19/01/2009, 12:47
Avatar de PabloSutra  
Fecha de Ingreso: octubre-2006
Ubicación: Guadalajara, México
Mensajes: 222
Antigüedad: 17 años, 6 meses
Puntos: 0
Respuesta: Asociar geturl a iconos cargados con xml

Qeu tal:
Lo que puedes hacer es ponerle una variable a t que sea un atributo del XML
por ejemplo dentro del for agrega
Cita:
t.direccion = nodes[i].attributes.url
y ya en la function released pones

Cita:
function released()
{
getURL(this._parent.direccion);
}
Espero te Sirva
SALUD!!!

Última edición por PabloSutra; 19/01/2009 a las 14:40 Razón: Error en la funcion
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 07:21.