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
| imgCharge=0;
var tableauImgChargex:Array = new Array();
var tableauImgChargey:Array = new Array();
monlv = new LoadVars();
_root.createEmptyMovieClip("ensemble",_root.getNextHighestDepth());
monlv.onLoad=function(etat){
if (etat){
images=this.liste.split(",");
nbImages=images.length;
monmcl = new MovieClipLoader():
_root.createEmptyMovieClip("mc_img",_root.getNextHighestDepth());
emcl = new Object();
emcl.onLoadError=function(cible,errorcode){
trace("erreur de chargement d'une image dans : " + cible._name + " code erreur : " + errorcode);
}
emcl.onLoadInit=function(cible)
{
imgCharge++;
tableauImgChargex[imgCharge]=getMCWidth(cible);
tableauImgChargey[imgCharge]=getMCHeight(cible);
trace("chgemt ok ds : " + cible._name+" taille = "+getMCWidth(cible)+" nb img chrgé="+imgCharge+"tableau="+tableauImgChargex[imgCharge]+" "+tableauImgChargey[imgCharge]+"\n");
largeur = 0;
if (imgCharge >= 19){
for(i=1;i<20;i++)
{
trace("ima"+i+" x="+_root["mc_img"+i]._x+" l="+tableauImgChargex[i]+" h="+tableauImgChargey[i]+"\n");
_root["mc_img"+i]._x=largeur;
_root["mc_img"+i]._height=372,2;
_root["mc_img"+i]._width=tableauImgChargex[i];
trace("l1="+largeur);
largeur=largeur+tableauImgChargex[i];
trace("l2="+largeur);
}
}
}
monmcl.addListener(emcl);
}else{
trace("erreur de chargement de la liste d'images ");
}
bouton1.onRelease=function() {
for (i = 1; i<20; i++)
{
_root.createEmptyMovieClip("mc_img"+i,_root.getNextHighestDepth());
monmcl.loadClip("images/" + images[i],"mc_img"+i);
}
}
function getMCWidth(target_mc:MovieClip):Number {
return target_mc._width;
}
function getMCHeight(target_mc:MovieClip):Number {
return target_mc._height;
}
}
monlv.load("liste_images.txt"); |
Partager