Bonjour à tous et à toutes!
Je suis entrain d'adapter une galerie flash de type carousel, trouvée sur Internet, avec mes propres images.
Pour l'instant je ne m'en sors pas trop mal. J'ai seulement un problème : lorsqu'on clique sur l'une des images pour qu'elle s'agrandisse, la précédente reste dessous, et comme elle ne font pas toute la meme taille, cela se voit...

J'ai essayé de regarder un peu le code, mais comme je débute, je ne comprends pas grand chose...

Merci d'avance pour votre aide Smiley smile
Modifié par namanisme (23 May 2012 - 10:27)
à oui autant pour moi...


galleryWidth = 800;
galleryHeight = 700;


actualWidth = 300;		//The actual images' width
//actualHeight = 300;		and height (the images which are going to be loaded through the XML file)
Ratio = actualWidth/actualHeight;

//BIG CENTER IMAGE PROPERTIES
//bigImageWidth = 450;	The width of the big image (the height is deducted from Ratio)
bigImageY = 95;			//The Y positon of the big image
bigImageX = 200;

//CAROUSEL PROPERTIES
imageSize = 80;		//the size of the images in the carousel
imagesX = 90;		//increase or decrese imagesX and imagesY to adjust the carousel position
imagesY = 320;

RadiusX = 280;		//images X radius
RadiusY = 350;		//images Y radius
focus = 700;		//images focus
Yspan = 80;			//images span
rotatingSpeed = 10;   	//recommended value between 1-30
initialRotate = 5; 		//set it to 0 for no initial image spin; set it negative to spin backwards

showDescription = true;
infoY = 40;				//The Y position of the description text

inColor = 20;			//images onRollOver color intensity
outColor = -20; 		//images onRollOut color intensity
coloringSpeed = 8
;		//the speed on changing color between onRollOver and onRollOut states

useMirror = true;		//set it to true if you want to use images mirror effect
//IMPORTANT! in order to have a proper mirror effect, the inner symbol must have the
//same width and height as the actual images' width and height (the same with actualWidth and actualHeight)
//see ScreenShot.jpg in the package

drawImagesFrames = false;		//if you want to have frames for the carousel images
imagesFrameColor = 0x222222;	//frame color
imagesFrameThick = 2;			//frame thickness
imagesFrameAlpha = 30;			//frame alpha

drawBigImageFrames = true;		//if you want to have frames for the big image
bigImageFrameColor = 0x999999;	//frame color
bigImageFrameThick = 2;			//frame thickness
bigImageFrameAlpha = 80;		//frame alpha

showFirstImage = true;			//whether it shows the first big image or not at the beginning
firstImage = 2;					//the number of the first image from the xml file


//don't need to edit the code below
import flash.geom.ColorTransform;
import flash.geom.Transform;
Stage.scaleMode = "noScale";
var xml:XML = new XML();
xml.ignoreWhite = true;

var mcLoader:MovieClipLoader = new MovieClipLoader();
var loadListener:Object = new Object();
var mcLoader2:MovieClipLoader = new MovieClipLoader();
var loadListener2:Object = new Object();

var images:Array = new Array();
var urls:Array = new Array();
var info:Array = new Array();
var pictures:Array = new Array();
var tg:Array = new Array();
ind=0;
loadXML = function () {
	var photos:Array = this.firstChild.childNodes;
	total = photos.length ;
	for (i=0;i<total;i++) {
		images.push((_root.folderPath?_root.folderPath:"") + photos[i].attributes.image);
		urls.push(photos[i].attributes.url);
		info.push(photos[i].attributes.info);
		tg.push(photos[i].attributes.target);
	}
	img = createEmptyMovieClip("img", 2);
	img._x = galleryWidth/4; 
	img._y = bigImageY;
	
	if(showDescription) {
		attachMovie("description", "Desc", 3);
		Desc._y = infoY;
		Desc._x = galleryWidth/2;
	}
	
	createEmptyMovieClip("thumbs", 1);
	thumbs._x = imagesX+325;
	thumbs._y = imagesY+32-Yspan;
	isLoading = true;
	iC = inColor + Math.abs(outColor);
	if (showFirstImage) loadImage(firstImage);
	speed = 0; slow=0; stp = true;
	a = 2*Math.PI/total;
	for (i=0; i<total; i++) {
		thumb = thumbs.createEmptyMovieClip("th"+i, i);
		myPic = thumb.createEmptyMovieClip("holder", 2);
		thumb.attachMovie("preload","pr"+i, 1);
		thumb["pr"+i]._x = thumb["pr"+i]._y = imageSize/2;
		myPic.loadMovie(images[i]);
		if (useMirror) {
			r = thumb.attachMovie("item","hold", 3);
			r.ref.inner.loadMovie(images[i]);
			r.ref.inner._width = r.ref.inner._height = imageSize;
			r._y = 2*imageSize;
			r._yscale=-100;
		}
		thumb.angle = a*i;
		thumb.show = panel;
		thumb.onClick(i);
		
		thumb.notLoaded = true;
		pictures.push(thumb);
		thumb.y = Yspan;
		var trans:Transform = new Transform(thumb);
		var colorTrans:ColorTransform = new ColorTransform();
		colorTrans.blueOffset = colorTrans.greenOffset = colorTrans.redOffset=colorTrans.alphaOffset= outColor;
		trans.colorTransform = colorTrans;
	}
	thumbs.onEnterFrame = function () {
		speed -= initialRotate*0.001;
		if ((_ymouse >30) && (_ymouse<galleryHeight-30) && (_xmouse>20+imagesX) && (_xmouse<galleryWidth-20)) { 
			speed -= this._xmouse*rotatingSpeed*0.00001;
			slow = this._xmouse*rotatingSpeed*0.00001;
			stp = false;
			initialRotate = 0;
		} 
		else 
		if (!stp) {
			speed -=slow;
			if(slow>0) slow -= 0.0007;
			else slow +=0.0007;
			if ((slow<0.001)&&(slow>-0.001))
				stp = true;
		}
		
		for (var i = 0; i<pictures.length; i++) {
			pictures[i].show();
		}
	}
	onEnterFrame = function() {
		
		for (i=0; i<photos.length; i++) {
			myMc = thumbs["th"+i].holder;
			th = thumbs["th"+i];
			if ((myMc.getBytesLoaded()/myMc.getBytesTotal() == 1) && (thumbs["th"+i].notLoaded))  {
					if (myMc._width>=myMc._height) {
						myMc._yscale = myMc._xscale=(100*(1-(myMc._width-imageSize)/(myMc._width)));
						myMc._y = (imageSize-myMc._height);
					}
					if (myMc._width<=myMc._height) {
						myMc._yscale = myMc._xscale=(100*(1-(myMc._height-imageSize)/(myMc._height)));
						myMc._x = (imageSize-myMc._width)/2;
					}
					if (myMc._width == myMc._height) {
						myMc._yscale = myMc._xscale=(100*(1-(myMc._width-imageSize)/(myMc._width)));
						myMc._x = myMc._y=0;
					}
					
					thumbs["th"+i].notLoaded = false;
					removeMovieClip(th["pr"+i]);
					if (drawImagesFrames)
					myMc.drawFrame(actualWidth,actualHeight,imagesFrameThick,imagesFrameColor,imagesFrameAlpha);
			}
			
		}

	}
}

xml.onLoad = loadXML;
xml.load((_root.folderPath?_root.folderPath:"") + "images.xml");

panel = function () {
		var angle = this.angle+speed;
		var x = Math.cos(angle)*RadiusX;
		var z = Math.sin(angle)*RadiusY;
		var y = this.y;
		var ratio = focus/(focus+z);
		this._x = x*ratio;
		this._y = y*ratio;
		this._yscale=100*ratio;
		this._xscale =this._yscale;
		this._x -= this._xscale/2;
		this.swapDepths(Math.round(-z));
		
	}

MovieClip.prototype.onClick = function(i) {
	this.onPress = function() {
	loadImage(i);
}
	this.onRollOver = function() {
		var trans:Transform = new Transform(this.holder);
		var colorTrans:ColorTransform = new ColorTransform();
		colorTrans.blueOffset = colorTrans.greenOffset = colorTrans.redOffset=colorTrans.alphaOffset=0;
		this.holder.onEnterFrame = function () {
			if (colorTrans.blueOffset < iC) {
			colorTrans.blueOffset = colorTrans.greenOffset = colorTrans.redOffset=colorTrans.alphaOffset+=coloringSpeed;
			trans.colorTransform = colorTrans;
			}
			
		}
	}
	this.onRollOut = function() {
		var trans:Transform = new Transform(this.holder);
		var colorTrans:ColorTransform = new ColorTransform();
		colorTrans.blueOffset = colorTrans.greenOffset = colorTrans.redOffset=colorTrans.alphaOffset= iC;
		this.holder.onEnterFrame = function () {
			if (colorTrans.blueOffset > 0) {
			colorTrans.blueOffset = colorTrans.greenOffset = colorTrans.redOffset=colorTrans.alphaOffset -= coloringSpeed;
			trans.colorTransform = colorTrans;
			}
		}
	}
}

MovieClip.prototype.drawFrame = function(w,h,fT,fC,fA) {
	this.lineStyle(fT, fC,fA,true,"none","round", "round");
	this.lineTo(w, 0);
	this.lineTo(w, h);
	this.lineTo(0, h);
	this.lineTo(0, 0);
}

loadImage = function(i) {
	
	indd = ind-2;
	inddd = ind-3;
	removeMovieClip(img["inner"+indd]);
	removeMovieClip(img["inner"+inddd]);
	ind+=2;
	inner = img.createEmptyMovieClip("inner"+ind, ind);
	innner = inner.createEmptyMovieClip("innner",1);
	masc = inner.attachMovie("mask","masc",2);	
	masc._visible = false;
	masc._width = bigImageWidth+20;
	masc._height = bigImageWidth/Ratio+20;
	masc._y = masc._x -= 10;
	masc.gotoAndStop(1);
	inner.setMask(masc);	
	
	loadListener.onLoadInit = function() {
			innner._width = bigImageWidth;
			innner._height = bigImageWidth/Ratio;
			masc._visible = true;
			masc.gotoAndPlay(1);
			Desc.desc.text = info[i];
			if(drawBigImageFrames)
				inner.drawFrame(inner.innner._width, inner.innner._height,bigImageFrameThick,bigImageFrameColor,bigImageFrameAlpha);			
	}	
	mcLoader.addListener(loadListener);
	mcLoader.loadClip(images[i], innner);
	
	inner.onRelease = function() {
		getURL(urls[i], tg[i]);
	}
	
	//inner2 is for adding the second mask
	indd = ind+1;
	inner2 = img.createEmptyMovieClip("inner"+indd, indd);
	innner2 = inner2.createEmptyMovieClip("innner2",1);
//	innner2.loadMovie(images[i]);
	masc2 = inner2.attachMovie("mask2","masc2",2);
	masc2._width = bigImageWidth+20;
	masc2._height = bigImageWidth/Ratio+20;
	masc2._y = masc2._x -= 10;
	masc2._visible = false;
	masc2.gotoAndStop(1);
	inner2._alpha = 65;
	inner2.setMask(masc2);	
	loadListener2.onLoadInit = function() {	
	
			innner2._width = bigImageWidth;
			innner2._height = bigImageWidth/Ratio;			
			masc2._visible = true;
			masc2.gotoAndPlay(1);
	}
	mcLoader2.addListener(loadListener2);
	mcLoader2.loadClip(images[i], innner2);
}
[/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i]
j'ai finalement chercher en profondeur dans le code, et il fallait simplement mettre

ind+=0;



ligne 235 au lieu de

ind+=2;


je ne sais pas si c'était vraiment ca le problème mais en tout cas ça a marché...