Bonjour à tous,
Je suis un peu un newbie en AS, et j'ai récupéré un code qui me permet de faire un diaporama automatique.
J'ai fait des modifications qui m'ont permis de ne pas utiliser le système de transitions original, car je voudrais le remplacer par une transition que vous pourrez voir dans l'intro de ce site (les "rideaux" noirs qui s'ouvrent et se referment):
[ Lien ]
J'ai donc créé un clip (caches) qui imite les "rideaux". Maintenant je voudrais l'utiliser pour faire la transition.
Voici le code :
nbrDePhotos = 8;
largeur = 813;
hauteur = 488;
coefficient = 0.20;
vitesseDeRotation = 5;
nbrMin = 4;
nbrMax = 10;
dscale = 0.20;
this.createEmptyMovieClip("chargement", 1);
chargement._x = 0.5*largeur;
chargement._y = 0.5*hauteur;
chargement.createTextField("texte", 0, - 0.5*largeur, 0, largeur, 20);
chargement.texte.selectable = false;
this.createEmptyMovieClip("diaporama", 0);
diaporama.attachMovie("caches", "caches_mc", 0);
diaporama._visible = 0;
for(var i = 0; i < nbrDePhotos; i++) {
var mc = this.diaporama.createEmptyMovieClip("photo" + i, i);
mc.loadMovie("mesphotos/photo" + i + ".jpg");
}
this.onEnterFrame = function() {
var total = 0;
var charge = 0;
for(var i = nbrDePhotos-1; i > 0; i--) {
total += this.diaporama["photo" + i].getBytesTotal();
charge += this.diaporama["photo"+ i].getBytesLoaded();
}
if(total != 0) {
var prc = Math.round(charge/total*100);
} else {
prc = 0;
}
chargement.texte.text = "chargement : " + prc + " %";
chargement.texte.setTextFormat(monFormatDeTexte);
if(prc == 100) {
delete this.onEnterFrame;
diaporama._visible = true;
chargement.vx = 0;
chargement.onEnterFrame = function() {
this.vx += 1;
this._x += this.vx;
if(this._x > largeur) {
creerLeMasque();
this.removeMovieClip();
}
}
}
}
numPhoto = nbrDePhotos - 1;
creerLeMasque = function() {
numPhoto--;
if(numPhoto < 0) {numPhoto = nbrDePhotos - 1;}
this.createEmptyMovieClip("masque", 2);
masque._x = 406;
masque._y = 244;
var n = Math.round(nbrMin + (nbrMax - nbrMin)*Math.random());
masque.tracerUneEtoile(560, 396, 4, 0, 0);
this.diaporama["photo" + numPhoto].setMask(masque);
var depth = this.diaporama.getNextHighestDepth();
this.diaporama["photo" + numPhoto].swapDepths(depth);
masque.scale =masque._xscale = masque._yscale = 0;
masque.drotation = 2*vitesseDeRotation*(Math.random() - 0.5);
masque.onEnterFrame = animerLeMasque;
}
animerLeMasque = function() {
this.scale += dscale;
this._xscale = this._yscale += this.scale;
this._rotation += this.drotation;
this._x += coefficient*(406 - this._x);
this._y += coefficient*(244 - this._y);
if(this._xscale > 100) {
this.removeMovieClip();
diaporama.caches_mc.gotoAndPlay(1);
creerLeMasque();
}
}
Merci à tous ceux qui pourront m'aider dans la résolution de ce problème.