var nbPicsInRub:Array = Array(0, 0, 0, 0);
var configVars = new LoadVars();
configVars.load("img_site/images.txt" );
configVars.onLoad = function() {
_root.nbPicsInRub[0] = this.rub0;
_root.nbPicsInRub[1] = this.rub1;
_root.nbPicsInRub[2] = this.rub2;
for (var nr=0; nr<3; nr++)
for (var ni=1; ni<=_root.nbPicsInRub[nr]; ni++)
addImageVignette(nr, ni);
}
var cpt=0;
var aVignetteMCL = new Array();//new MovieClipLoader();
var avMCListen = new Array();//new Object();
var printopen=0;
var multiopen=0;
var persoopen=0;
var contactopen=0;
var menuItemAct = -1;
var selectedVignette = -1;
var tailleVignettesW = 38;
var tailleVignettesH = 38;
var posVignettesX = 102;
var posVignettesY = 20;
var nbVignettesByRow = 20;
var betweenVignettesX = 35;
var betweenVignettesY = 35;
var imgVignettesOffsetX = -6;
var imgVignettesOffsetY = -6;
var timeBetweenVignettes = 40;
var nomrub:Array = Array('print', 'multi', 'perso', 'contact');
var vignettesMC:Array = new Array();
function deuxChiffres(num) {
if (num<10) return '0'+num;
else return num;
}
//crea images vignettes
function addImageVignette(rub, num) {
nom_img = "vignette_img_"+_root.nomrub[rub]+"_"+num;
_root.createEmptyMovieClip(nom_img, _root.getNextHighestDepth());
len = _root.aVignetteMCL.push(new MovieClipLoader());
mcl = _root.aVignetteMCL[len - 1];
len = _root.avMCListen.push(new Object());
lis = _root.avMCListen[len - 1];
lis.onLoadInit = function(cible) {
var tab = cible._name.split('_');
cible.numVignette = tab[tab.length-1] - 1;
num = cible.numVignette;
if (num <= _root.nbVignettesByRow) {
vgX = num;
vgY = 0;
}
else {
vgX = num - _root.nbVignettesByRow - 1;
vgY = 1;
}
vX = _root.posVignettesX + vgX*_root.betweenVignettesX + _root.imgVignettesOffsetX;
vY = _root.posVignettesY + vgY*_root.betweenVignettesY + _root.imgVignettesOffsetY;
vW = _root.tailleVignettesW;
vH = _root.tailleVignettesH;
cible._x = vX;
cible._y = vY;
cible._visible = false;
trace('#');
}
lis.onLoadProgress = function() {
// DEBUG
_root.tracetxtmc.text = _root.tracetxtmc.text + '#';
trace('.');
}
mcl.addListener(lis);
mcl.loadClip('img_site/vignettes_'+nomrub[rub]+'/'+deuxChiffres(num)+'.jpg', _root[nom_img]);
}
stop();