El problema es que en el tutorial se manejan datos como imágenes y textos pero no URL's.
Os expongo los códigos y luego las dudas.
Código :
El XML <icons> <icon image="hogar.swf" tooltip="Hogar" url="http://www.tuweb.com/1.pdf" /> <icon image="personal.swf" tooltip="Cuidado personal" url="http://www.tuweb.com/2.pdf" /> <icon image="bolsos.swf" tooltip="Bolsos y viaje" url="http://www.tuweb.com/3.pdf" /> <icon image="escritura.swf" tooltip="Escritura y oficina" url="http://www.tuweb.com/4.pdf" /> <icon image="relojes.swf" tooltip="Relojes y Electrónica" url="http://www.tuweb.com/5.pdf" /> <icon image="mecheros.swf" tooltip="Encendedores" url="http://www.tuweb.com/6.pdf" /> <icon image="herramientas.swf" tooltip="Herramientas" url="http://www.tuweb.com/7.pdf" /> <icon image="juegos.swf" tooltip="Juegos" url="http://www.tuweb.com/8.pdf" /> <icon image="paraguas.swf" tooltip="Paraguas" url="http://www.tuweb.com/9.pdf" /> <icon image="textil.swf" tooltip="Textil" url="http://www.tuweb.com/10.pdf" /> <icon image="playa.swf" tooltip="Camping y playa" url="http://www.tuweb.com/11.pdf" /> </icons>
Código :
El Action Script
import mx.utils.Delegate;
var numOfItems:Number;
var radiusX:Number = 300;
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.content = nodes[i].attributes.content;
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()
{
var sou:Sound = new Sound();
sou.attachSound("sover");
sou.start();
home.tooltip.tipText.text = this._parent.toolText;
home.tooltip._x = this._parent._x;
home.tooltip._y = this._parent._y - this._parent._height/2.6;
home.tooltip.onEnterFrame = Delegate.create(this,moveTip);
home.tooltip._alpha = 100;
}
function out()
{
delete home.tooltip.onEnterFrame;
home.tooltip._alpha = 0;
}
function released()
{
var sou:Sound = new Sound();
sou.attachSound("sdown");
sou.start();
}
function moveTip()
{
home.tooltip._x = this._parent._x;
home.tooltip._y = this._parent._y - this._parent._height/2.6;
}
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)/1800;
}La pregunta es sencilla, no se si la explicación lo es tanto. ¿Cómo hago para cargar la variable url del xml y que en la función released de as la obtenga?
Cada icono debería obtener su url que al ser un pdf se iniciaría una descarga.
Muchas gracias.
