difficile d'explquer avec des éléments graphiques à créer, je donc te passer un script qui créé dynamiquement tout cela, tout est expliqué dedans. pour la mise en œuvre, tu places ce script sur la première image-clef de ta time-line, et plus loin, image 5 par exemple (avec un stop();) ton lecteur mp3, et c'est tout.
code sur la 1ere image :
/* posX = loader Position X-axe posY = loader Position Y-axe largeur = largeur valide de la barre de chargement en pixels attente = temps d'attente en seconde image = image où doit aller la tête de lecture signal = saut d'image (1: GotoAndPlay ou 0: GotoAndStop)
*/ Movieclip.prototype.loader = function(posX, posY, largeur, attente, image, signal) { this.createEmptyMovieClip("pre", 1); pre.onEnterFrame = function() { // Position du Preloader this._x = posX; this._y = posY; // Total & chargement this.total = _root.getBytesTotal(); this.charge = _root.getBytesLoaded(); // Calcul du pourcentage pourcent = (int((this.charge/this.total)*100)); // Création et état barre de chargement, à toi de mofier les tailles et les x et y this.createEmptyMovieClip("bar", 2); this.bar.beginFill(0xff0000, 100); this.bar.moveto(pourcent*largeur/100, 10); this.bar.lineto(pourcent*largeur/100, 0); this.bar.lineto(0, 0); this.bar.lineto(0, 10); this.bar.lineto(10, 10); this.bar.endFill(); // Création du champ de texte, à toi de mofier les tailles et les x et y this.createTextField("pChamp", 1, 0, 0, 100, 16); this.pChamp.autoSize = "left"; this.pChamp.selectable = false; this.pChamp._y += 10; // Format du champ de texte, à toi de mofier la typo, le corps du texte et la couleur this.mForm = new TextFormat(); this.mForm.font = "Arial"; this.mForm.size = 10; this.mForm.color = 0x000000; this.pChamp.text = pourcent+"%"; this.pChamp.setTextFormat(this.mForm); if (this.total == this.charge) { _root.Pause(attente, image, signal); } }; }; MovieClip.prototype.Pause = function(pTemps, image, sig) { this.stop(); var go = function (obj) { pre.removeMovieClip(); if (sig) { obj.gotoAndPlay(image); } else { obj.gotoAndStop(image); } clearInterval(id); }; var id = setInterval(go, pTemps*1000, this); }; loader(200, 200, 150, 2, 5, 0); stop();
Alise from RunIsland
|