Aide - Recherche - Membres - Calendrier
Version complète : probleme avec menu carousel en xml
Centre de Formation Flash - Forums Adobe Flash > Adobe Flash > Gestion de données dynamiques
pegazus
Hi!

En fait j'ai un soucis avec mon menu réalisé en xml grace à un tuto.

je voudrais en cliquant sur une des icones aller sur un lien internet...

Mon code AS :

import mx.utils.Delegate;

var numOfItems:Number;
var radiusX:Number = 275;
var radiusY:Number = 50;
var centerX:Number = Stage.width / 2;
var centerY:Number = Stage.height / 2;
var speed:Number = 0.01;
var perspective:Number = 50;
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 = function() {
getURL(this.lien);

}
}
}

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)/12000;



Mon fichier xml :

<?xml version="1.0" ?>


<icons>

<icon image="icon1.png" tooltip="espace video"

lien="http://www.google.fr"

/>

<icon image="icon2.png" tooltip="espace web"

lien="http://www.google.fr"

/>



<icon image="icon3.png" tooltip="espace mariage"

lien="http://www.google.fr"
/>

</icons>


}
pegazus
Personne ne connait la réponse icon_eek.gif

pegazus
20€ par paypal!

pour celui qui arrive à faire marcher les liens web de cet anim...

et c'est serieux! apres vérif du swf, je vous envoie la money

J'en ai besoin rapidement..
D4Y.be
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 = function() {
getURL(this.lien);
}

D'où vient ta variable "lien" ?
logone
Salut,

Voici comment j'ai contourné le pb

Action Script


import mx.utils.Delegate;
import mx.transitions.Tween;
import mx.transitions.easing.*;
var numOfItems:Number;
var radiusX:Number = 300;
var radiusY:Number = 75;
var centerX:Number = Stage.width / 2.2;
var centerY:Number = Stage.height / 2;
var speed:Number = 0;
var perspective:Number = 130;
var home:MovieClip = this;
theText._alpha = 0;

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 = unescape(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()
{
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;
this._alpha = 200;
}

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

function released()
{

home.tooltip._alpha = 0;
for(var i=0;i<numOfItems;i++)
{

var t:MovieClip = home["item"+i];
t.xPos = t._x;
t.yPos = t._y;
t.theScale = t._xscale;
delete t.onEnterFrame;
if(t != this._parent)
{
}
else
{
//trace (t.content);
_global.content = t.content;
_root.gotoAndPlay("link");

var s:Object = this;
tw.onMotionStopped = function()
{
s.onRelease = unReleased;
}
}
}
}


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._alpha = 50;
}

this.onMouseMove = function()
{
speed = (this._xmouse-centerX)/35000;
}


sur la 1ere image un MC vide avec le code et un stop
sur la seconcde image un titre link
puis

Action Script


onClipEvent(load){
trace ("link ok" +_global.content);
if (_global.content == "link1"){
loadMovie("lien", 1);
//ou getURL("lien", _blank);
}
if (_global.content == "link2"){
etc... etc...
}


A+++
Ceci est une version "bas débit" de notre forum. Pour voir la version complète avec plus d'informations, la mise en page et les images, veuillez cliquer ici.
Invision Power Board © 2001-2009 Invision Power Services, Inc.