1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103
| // dimensions de la scene
var scene_w=Stage.width;
var scene_h=Stage.height;
var unite:Number=1; // unite de deplacement
var W:Number=150; // dimensions des vignettes
var H:Number=100;
var nbimage:Number=8;
//etat de l'action
var action:Number=1;
// fonction pour faire avancer mon image
function avance(clip,id)
{
clip.onEnterFrame=function()
{
if (_root.action==1)
{
this._x-=_root.unite; // on avance l'image
}
if (this._x<-this._width)
{
// on repositionne le clip au début
this._x += _root.W*_root.nbimage;
this._y = _root.scene_h-(this._height*3/2);
}
//Si l'image est survolée je la stop
clip.onRollOver=function()
{
_root.action=0;
clip.swapDepths(_root.nbimage+1); // je place mon image au dessus de tout
clip.onEnterFrame=function()
{
if (this._width<_root.W*2)
{
width0=this._width;
this._width=this._width*1.06;
this._height=this._height*1.06;
this._x=this._x-((this._width-width0)/2); // on agrandit l'image par son centre
this._y=(_root.scene_h-this._height)/2;
}
}
}
clip.onRelease=function()
{
getURL(_root.lien[id],"_self");
}
clip.onRollOut=function()
{
_root.action=1;
clip.swapDepths(id); // je place mon image en dessous
width0=this._width;
this._height=_root.H;
this._width=_root.W;
this._x=this._x-((this._width-width0)/2); // on replace la vignette où elle etait
this._y=(_root.scene_h-this._height)/2;
avance(clip,id);
}
}
}
// on remplit le tableau des liens
var lien:Array = new Array();
lien[0]="http://www.piertec.fr/carreaux_nemosa.php";
lien[1]="http://www.piertec.fr/dalle_tolosa.php";
lien[2]="http://www.piertec.fr/dalle_massilia.php";
lien[3]="http://www.piertec.fr/concept_fidji.php";
lien[4]="http://www.piertec.fr/concept_aubrac.php";
lien[5]="http://www.piertec.fr/dalle_nicia.php";
lien[6]="http://www.piertec.fr/concept_canisse.php";
lien[7]="http://www.piertec.fr/dalle_lutece.php";
this.createEmptyMovieClip("conteneur", _root.getNextHighestDepth());// je crée un clip vide qui va contenir toutes les vignettes
for (i=0; i<nbimage; i++)
{
conteneur.createEmptyMovieClip("vignette"+i, i);
var mcLoader:MovieClipLoader = new MovieClipLoader();
var ecouteur:Object = {};
ecouteur.i=i;
ecouteur.onLoadInit = function()
{
conteneur["vignette"+this.i]._width = _root.W;
conteneur["vignette"+this.i]._height = _root.H;
conteneur["vignette"+this.i].i=this.i;
avance(conteneur["vignette"+this.i],this.i);
}
mcLoader.addListener(ecouteur);
mcLoader.loadClip("flash/"+i+".jpg", conteneur["vignette"+i]);
if (i>0)
{
conteneur["vignette"+i]._x = _root.W+conteneur["vignette"+(i-1)]._x; // je place mon vignette à côté de la précédente
}
else
{
conteneur["vignette"+i]._x = 0;
}
conteneur["vignette"+i]._y = _root.scene_h-(_root.H*3/2);
conteneur["vignette"+i].i=i;
} |
Partager