Importation d'animation contenant de l'actions script
nouseforyav
Messages postés39Date d'inscriptionlundi 19 avril 2004StatutMembreDernière intervention26 mai 2005
-
23 mars 2005 à 17:16
nouseforyav
Messages postés39Date d'inscriptionlundi 19 avril 2004StatutMembreDernière intervention26 mai 2005
-
23 mars 2005 à 20:05
Salut,
j'ai un petit soucis concernant l'importation dune animation.
En fait il s'agit d'un faux spectrum (equalizer) qui bouge en fonction de la musique.
Lorsque j'importe le truc, c'est une somme de symbole sans code. Or lorsque j'applique le code sur l'image clé, il s'applique à toute ma page!! C'est donc toute l'animation qui devient spectrum!
En soit, en tant que fichier swf inépendant, il tourne nikel, mais dès que je l'exporte plus rien ne va!
Pour avoir une petite idée, voici le code que j'applique au faux spectrum:
// Project: make a fake equalizer like movie clip for use when music is playing in Flash
// project has lines and toppers, each labeled linex & topperx where x is 1 to 20.
// the lines make up the tall parts of the equalizer, the toppers are just a line placeholder
// for the max value of the lines
// define initial arrays
barboty=new Array(); //holds bottom of each line's _y registration point
randheight=new Array(); //holds randomly generated height of line
toppery=new Array(); //holds _y registration point of topper
decfraction=new Array(); //holds the fraction of randomheight of line that will be used to decrement the line's height
numbars=20; //defines number of lines
maxheight=40; //defines max height of line
minheight=1; //defines min height of line
gap=2; //defines distance between top of line and topper
topperdrop=.075; //defines value to decrement _y value of topper
numsteps=7; //defines number of steps to decrement height of line
// this function sets values for the heights of each line in the equalizer
function initbars() {
for (i=1;i<_root.numbars+1;i+=1) {
barboty[i]=eval("_root.line"+i)._y;
randheight[i]=Math.random()*maxheight;
toppery[i]=barboty[i]-randheight[i]-gap;
decfraction[i]=randheight[i]/(_root.numsteps);
// set initial line height and position of topper
setProperty(eval("_root.line"+i),_height,_root.randheight[i]+_root.minheight);
setProperty(eval("_root.topper"+i),_y,barboty[i]-randheight[i]-_root.gap-_root.minheight);
}
}
// this function will get executed at the playing frame rate of the movie, even if the movie is stopped
_root.onenterFrame = function() {
for (j=1;j<_root.numbars+1;j+=1) { //set height of each line for each j in numbars
setProperty(eval("_root.line"+j),_height,_root.randheight[j]);
if (_root.randheight[j]<=_root.minheight) { // if the line height is less than the min, then:
// set line height to the min then reinit the line heights etc
setProperty(eval("_root.line"+j),_height,_root.minheight);
_root.initbars(); // the entire function initbars could be placed here if you like rather than being called.
} else { //if not too short, decrement height of lines and position of topper
_root.randheight[j]=_root.randheight[j]-_root.decfraction[j];
setProperty(eval("_root.topper"+j),_y,eval("_root.topper"+j)._y+_root.topperdrop);
}
}
}
je peux mettre le fla en téléchargement ou le faire passer sur demande.
Merci à celui qui me filera un coup de main.
Nouseforyav
A voir également:
Importation d'animation contenant de l'actions script
Ensuite, je viens de voir que tu as des "_root" un peu partout.
Tu te rends compte que si ce code est dans un clip et qu'il vient d'être chargé, "_root" n'est plus au même niveau ?
nouseforyav
Messages postés39Date d'inscriptionlundi 19 avril 2004StatutMembreDernière intervention26 mai 2005 23 mars 2005 à 19:23
Ok pour l'actualisation du code, je vais voir ça de plus près, mais je ne suis pas développeur, juste simple designer, donc j'essaye de récupérer des codes propres sur le net...Là ct sur un site US en l'occurence.
Donc pour l'autre problème, que devrais-je mettre à la place des "_root" pour que mon clip apparaisse comme n'importe quelle importation de swf?
merci pour tes conseils
nouseforyav
Messages postés39Date d'inscriptionlundi 19 avril 2004StatutMembreDernière intervention26 mai 2005 23 mars 2005 à 19:58
Tu peux télécharger le fla à l'adresse suivante, car là le code est trop compliqué pour moi!!
http://perso.wanadoo.fr/yavarith.ty/fla Bon courage si le coeur t'en dit
Nouseforyav
Vous n’avez pas trouvé la réponse que vous recherchez ?