webForumDet fria alternativet

Preloader för varje bild?

Flashur Flash, Shockwave

2 svar · 224 visningar · startad av crisse6

Medlem sedan dec. 20002 526 inlägg
Frågan#1

Hej!

Har min slideshow men har inte mkt koll på AS ännu så skulle behöva hjälp med preloader för varje bild. När man trycker på NEXT SLIDE laddas som det låter nästa slide in genom xml. Jag skulle då vilja att det animeras typ en rektangel som ökar i bredd beroende på hur många procent som laddats in, och sen försvinna snabbt därifrån (typ animeras baklänges :D) så man ser bilden.

Någon som skulle kunna hjälpa?

Medlem sedan dec. 20002 526 inlägg
#2

Har ju försökt, men det händer ingenting.... Stapel mc är det linkage på. Det ska ju bara visas när det behövs...

slides_xml = new XML();
slides_xml.onLoad = startSlideShow;
slides_xml.load("pictures.xml");
slides_xml.ignoreWhite = true;
clickSound = new Sound(this);
clickSound.attachSound("klick");
//
// Show the first slide and intialize variables
function startSlideShow(success) {
	if (success == true) {
			rootNode = slides_xml.firstChild;
			totalSlides = rootNode.childNodes.length;
			firstSlideNode = rootNode.firstChild;
			currentSlideNode = firstSlideNode;
			currentIndex = 1;
			updateSlide(firstSlideNode);

	}
}
//
// Updates the current slide with new image and text 
function updateSlide(newSlideNode) {
	imagePath = newSlideNode.attributes.jpegURL;
	slideText = newSlideNode.firstChild.nodeValue;
	loadMovie(imagePath, targetClip);
}

//
// Event handler for 'Next slide' button
next_btn.onRelease = function() {
	nextSlideNode = currentSlideNode.nextSibling;
	if (nextSlideNode == null) {
		break;
	} else {
		
	//NYA
	var totalSize; // den totala filmstorleken
	var amountLoaded; // hur mycket som laddats ner
	var hej; // procent av den totala filmstorleken

	totalSize=_root.getBytesTotal();
	trace (totalSize);
	amountLoaded=_root.getBytesLoaded();
	hej=(amountLoaded/totalSize)*100;

	stapel._xscale=hej;

	if (hej==100) {
	currentIndex++;
	updateSlide(nextSlideNode);
	currentSlideNode = nextSlideNode;

}
//SLUT NYA

		
		/* ORGINAL!
		clickSound.start(0, 1);
		clickSound.stop(klick);
		currentIndex++;
		updateSlide(nextSlideNode);
		currentSlideNode = nextSlideNode;
		*/
	}

};
//
// Event handler for 'Previous slide' button
back_btn.onRelease = function() {
	previousSlideNode = currentSlideNode.previousSibling;
	if (previousSlideNode == null) {
		break;
	} else {
		clickSound.start(0, 1);
		clickSound.stop(klick);
		currentIndex--;
		currentSlideNode = previousSlideNode;
		updateSlide(previousSlideNode);
	}
};

Please?

Medlem sedan dec. 20002 526 inlägg
#3

Okej. Nu har jag kommit en bit på vägen. Skulle behöva hjälp med det sista. Den preloadar med rektangeln nu, men när den försvinner så är det som om bilden då läses in!
Why?

next_btn.onRelease = function() {
	nextSlideNode = currentSlideNode.nextSibling;
	if (nextSlideNode == null) {
		break;
	} else {
	
	var totalSize; // den totala filmstorleken
	var amountLoaded; // hur mycket som laddats ner
	var proc; // procent av den totala filmstorleken
	stapel.onEnterFrame = function() {
		
	totalSize=_root.targetClip.getBytesTotal();
	amountLoaded=_root.targetClip.getBytesLoaded();
	proc=(amountLoaded/totalSize)*100;
	trace (proc);		
	if (stapel._width>=900 && proc==100) {
		delete stapel.onEnterFrame
		currentIndex++;
		updateSlide(nextSlideNode);
		currentSlideNode = nextSlideNode;
		stapel._width=1;
		}
	else {
		
	stapel._xscale += proc;
	}
	}
	}

};

Snälla någon...

140 ms totalt · 3 externa anrop · v20260731065814-full.25f56b17
0 ms — hämta forumlista (cache)
0 ms — hämta statistik (cache)
137 ms — hämta tråd, inlägg och bilagor (db)