webForumDet fria alternativet

skapa tweens på dynamiskt movieclip

Flash

0 svar · 255 visningar · startad av altruism

Medlem sedan nov. 200664 inlägg
Frågan#1

Jag har följt (och modifierat) en tutorial om hur man skapar ett bildgalleri i flash genom att läsa in bilderna från ett xml-dokument men har nu stött på ett problem. Jag skulle vilja ha lite hover-effekter på thumbnailsen som ligger i ett movieclip men jag får inte till det. Jag kan bara lägga på effekter på hela movieclipet, inte bilderna som ligger i det. Såhär ser galleriet ut nu: http://www.mattiasbrage.se/natur.html
Det är alltså varje individuell thumbnail som jag vill förstora när man för musen över.

Såhär ser koden ut:

#include "mc_tween2.as"
//create a new xml object 
myPhoto = new XML();
myPhoto.ignoreWhite = true;
//function performed once the loading is complete.
myPhoto.onLoad = function(success) {
	numimages = this.firstChild.childNodes.length;
	spacing = 70;
	spacing_y = 70;
	x_count = -1;
	y_count = 0;
	loader._alpha = 0;
	// create a loop which repeats it self for the total number of images.
	for (i=0; i<numimages; i++) {
		// assigns a temporary name for each of the childNodes so that they can be referenced later on in the loop.
		this.picHolder = this.firstChild.childNodes[i];
		//create a unique movie clip for each thumbnail, assign a temporary reference thumbholder for the movieclips
		this.thumbHolder = thumbnails.createEmptyMovieClip("thumbnail"+i, i);
		//create new movie and then load the thumbnails into it.
		this.thumbLoader = this.thumbHolder.createEmptyMovieClip("thumbnail_image", 0);
		this.thumbLoader.loadMovie(this.picHolder.attributes.thmb);
		this.thumbHolder.title = this.picHolder.attributes.title;
		this.thumbHolder.main = this.picHolder.attributes.main;
		x_count++;
		if (x_count == 3) {
			y_count++;
			x_count = 0;
		}
		this.thumbHolder._x = x_count*spacing;
		this.thumbHolder._y = y_count*spacing_y;
		
		this.thumbHolder.onRollOver = function() {
			thumbLoader.thumbnail_imgage.resizeTo(120, 120, 1, "easeInOutCirc");
		}
		this.thumbHolder.onRelease = function() {
			loader.loadMovie(this.main);
			loader.alphaTo(100, 1, "easeInOutCirc");
			loader._alpha=0;
		};
	}
};
myPhoto.load("xmlphoto3.xml");
260 ms totalt · 4 externa anrop · v20260731065814-full.a51de22e
120 ms — deklarationer (db)
0 ms — hämta statistik (cache)
128 ms — hämta tråd, inlägg och bilagor (db)
129 ms — ändringar (db)