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 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249
|
MovieClip.prototype.traceRectangle=function(xPos,yPos,width,height,fillColor,lineColor,alpha){
this.beginFill(fillColor,alpha);
this.lineStyle(1,lineColor,alpha);
this.moveTo(xPos,yPos);
this.lineTo(xPos+width,yPos);
this.lineTo(xPos+width,yPos+height);
this.lineTo(xPos,yPos+height);
this.lineTo(xPos,yPos);
this.endFill();
}
MovieClip.prototype.setPreloader=function(obj){
//Récup valeur(1,2,3,4)
var level = obj.level;
this.traceRectangle(0,0,150,9,0xffffff,0x515151,100);
this.createEmptyMovieClip("barre",1);
this.barre._x=5;
this.barre._y=5;
this.barre.percent=0;
this.createTextField("message",2,63,10,40,20);
this.onEnterFrame = function() {
this.barre.clear();
this.barre.traceRectangle(-3,-3,100*this.barre.percent,5,0x67fdfc,0xffffff,100);
this.barre.percent=obj.getBytesLoaded()/obj.getBytesTotal();
//Récupération du % t
partChargement = Math.ceil((obj.getBytesLoaded()/obj.getBytesTotal())*100);
affichageChargement = partChargement+" %";
this.message.text=affichageChargement;
var my_message:TextFormat = new TextFormat();
my_message.font = "Verdana";
my_message.color = 0x000000;
this.message.setTextFormat(my_message);
/*****************************************************************/
if (this.barre.percent>=0.99&&!isNaN(this.barre.percent)) {
if(this._parent.massLoadWorking!=undefined)
this._parent.massLoadWorking=false;
this.removeMovieClip();
}
}
}
MovieClip.prototype.loadFile=function(obj){
/*
** la variable en parametre est un objet du type:
** {type:a,file:b,newName:c,level:d}
*/
var type=obj.type;
var file=obj.file;
var newName = obj.newName;
var newlegende = obj.newLegende;
var width = obj.width;
var height = obj.height;
var level = obj.level;
//positionnement du clip-photo "newName" + clip-preload
if (height<width) { clipX = 195+((level-1)*677); }
else { clipX = 195+((level-1)*677); }
this.createEmptyMovieClip("control",(level+1));
this.control._x=clipX+((width-150)/2);
this.control._y=((height-40)/2);
this.createEmptyMovieClip(level+newName,level);
this[level+newName].loadMovie(file);
this[level+newName]._x = clipX;
trace("newName"+this[level+newName]);
this.control.setPreloader(this[level+newName]);
//trace("OK loadFile");
}
MovieClip.prototype.chargeTexte=function(obj){
/*
** la variable en parametre est un objet du type:
** {type:a,file:b,newName:c,level:d}
*/
var type=obj.type;
var file=obj.file;
var newName = obj.newName;
var newlegende = obj.newLegende;
var width = obj.width;
var height = obj.height;
var level = obj.level;
//positionnement du clip-Texte "text"
if (height<width) { posX = ((level-1)*677); posY = 5; }
else { posX = ((level-1)*677); posY = 5; }
var texte = "text"+(level-1);
this.attachMovie("text", texte, (level-1));
//trace("Niveau text="+(level-1));
this[texte].nomTitre = newName;
this[texte].nomLegende = newlegende;
this[texte]._x = posX;
this[texte]._y = posY;
//trace("OK chargeTexte");
}
// Variables de paramétrage de la navigation basse
// infos slide pages galerie
var vitesse = 0.25;
var frottement = 0.40;
var placex = 0;
// Création du tableau qui contient les positions de la slide
var position = 0;
var ordonnee = new Array();
// Changement de couleur du texte en Rollover
var couleurTxt = new TextFormat();
couleurTxt.color = 0x000000;
var couleurTxtHover = new TextFormat();
couleurTxtHover.color = 0x67fdfc;
MovieClip.prototype.chargeNav=function(obj){
var i = (obj.level-1);
var nbrMenus = obj.nbrMenus;
// Récupération des ordonnées de chaque page(oeuvre)
var tab = new Array;
tab = (310-(i*677));
ordonnee.push(tab);
_root["menu"+i].element_Inst.setTextFormat(couleurTxt);
//trace("chargeNav Level="+i+" Ordonnée="+ordonnee[i]);
_root["menu"+i].onPress = function() {
destX = destX == ordonnee[i] ? 310 : ordonnee[i];
position = i;
trace("Position i="+_global.position);
mc_calcul.onEnterFrame = function() {
decalx = vitesse*(destX-_root.mc_oeuvre._x);
placex += decalx;
placex *= frottement;
_root.mc_oeuvre._x += placex;
//trace("Position McOeuvre="+_root.mc_oeuvre._x);
}
}
// Rollover sur les boutons de pages
_root["menu"+i].onRollOver = function() {
this.couleurDeFond.setRGB(0x67fdfc);
this.element_Inst.setTextFormat(couleurTxtHover);
}
_root["menu"+i].onRollOut = function() {
this.couleurDeFond.setRGB(0x000000);
this.element_Inst.setTextFormat(couleurTxt);
}
// déplacemement des boutons suivant/précédent
//trace("Position="+i+" NbrMenus"+nbrMenus);
_root.bt_flecheD.couleurDeFond.setRGB(0x000000);
_root.bt_flecheD.onPress = function() {
if(position<(nbrMenus-1)) position += 1;
destX = destX == (ordonnee[position]) ? mc_oeuvre._x : (ordonnee[position]);
mc_calcul.onEnterFrame = function() {
decalx = vitesse*(destX-mc_oeuvre._x);
placex += decalx;
placex *= frottement;
mc_oeuvre._x += placex;
}
}
_root.bt_flecheD.onRollOver = function() { this.couleurDeFond.setRGB(0x67fdfc); }
_root.bt_flecheD.onRollOut = function() { this.couleurDeFond.setRGB(0x000000); }
_root.bt_flecheG.couleurDeFond.setRGB(0x000000);
_root.bt_flecheG.onPress = function() {
if(position>0) position -= 1;
destX = destX == (ordonnee[position]) ? mc_oeuvre._x : (ordonnee[position]);
mc_calcul.onEnterFrame = function() {
decalx = vitesse*(destX-mc_oeuvre._x);
placex += decalx;
placex *= frottement;
mc_oeuvre._x += placex;
}
}
_root.bt_flecheG.onRollOver = function() { this.couleurDeFond.setRGB(0x67fdfc); }
_root.bt_flecheG.onRollOut = function() { this.couleurDeFond.setRGB(0x000000); }
// déplacemement des boutons début/fin
_root.bt_flecheGG.couleurDeFond.setRGB(0x000000);
_root.bt_flecheGG.onPress = function() {
position = 0;
destX = destX == 310 ? mc_oeuvre._x : 310;
mc_calcul.onEnterFrame = function() {
decalx = vitesse*(destX-mc_oeuvre._x);
placex += decalx;
placex *= frottement;
mc_oeuvre._x += placex;
}
}
_root.bt_flecheGG.onRollOver = function() { this.couleurDeFond.setRGB(0x67fdfc); }
_root.bt_flecheGG.onRollOut = function() { this.couleurDeFond.setRGB(0x000000); }
if(i==(nbrMenus-1)){
//trace("i="+i);
_root.bt_flecheDD.couleurDeFond.setRGB(0x000000);
_root.bt_flecheDD.onPress = function() {
//this.couleurDeFond.setRGB(0xFFFFFF);
position = nbrMenus-1;
destX = destX == (310-((nbrMenus-1)*677)) ? mc_oeuvre._x : (310-((nbrMenus-1)*677));
mc_calcul.onEnterFrame = function() {
decalx = vitesse*(destX-mc_oeuvre._x);
placex += decalx;
placex *= frottement;
mc_oeuvre._x += placex;
}
}
_root.bt_flecheDD.onRollOver = function() { this.couleurDeFond.setRGB(0x67fdfc); }
_root.bt_flecheDD.onRollOut = function() { this.couleurDeFond.setRGB(0x000000); }
}
}
var preloadOK=new Array();
var menuOK=new Array();
var prelaodAll=false;
var j=0;
MovieClip.prototype.massLoad = function(objects){
/*
** les variables en parametre sont des objets du type:
** {type:a,file:b,newName:c,level:d}
*/
this.massLoadWorking=false;
this.massLoadList=new Array();
for(var i=0;i<arguments.length;i++)
this.massLoadList.push(arguments[i]);
//trace("éléments Tab="+this.massLoadList.length);
this.onEnterFrame=function(){
if(!this.massLoadWorking&&this.massLoadList.length>0){
//trace("OK"+this.massLoadList.length);
var remplir = this.massLoadList.shift();
this.loadFile(remplir);
this.mc_texte.chargeTexte(remplir);
_root["menu"+j].chargeNav(remplir);
/*on met la valeur Length(0/1/2/3...) dans un tableau une fois l'image chargée */
preloadOK.push(this.massLoadList.length);
//trace("OK preload="+preloadOK);
/* et on précise que maintenant, on est plus à l'arret
** donc la fonction attendra d'avoir fini le chargement pour en lancer un autre */
this.massLoadWorking=true;
j++;
}
//if(this.massLoadWorking&&!this.massLoadList.length>0){ prelaodAll = true; trace("Prelaod des images fini") }
}
} |
Partager