---
title: "Preloader för varje bild?"
type: "forum-thread"
url: "https://www.webforum.nu/amne/flash/136547-preloader-för-varje-bild"
topic: "Flash"
topic_url: "https://www.webforum.nu/amne/flash"
author: "crisse6"
published: "2005-10-28T14:57:07.000Z"
updated: "2005-11-04T13:12:50.000Z"
replies: 2
views: 243
page: 1
pages: 1
language: "sv-SE"
site: "webForum — webforum.nu"
rights: "Upphovsrätten till varje inlägg tillhör dess författare."
attribution: "Citera som: webForum, https://www.webforum.nu/amne/flash/136547-preloader-för-varje-bild"
---

# Preloader för varje bild?

## #1 — crisse6, 2005-10-28T14:57Z

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?

Permalänk: https://www.webforum.nu/p/136547

## #2 — crisse6, 2005-10-29T18:51Z

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?

Permalänk: https://www.webforum.nu/p/1696732

## #3 — crisse6, 2005-11-04T13:12Z

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...

Permalänk: https://www.webforum.nu/p/1698957

---

Tråden på webben: https://www.webforum.nu/amne/flash/136547-preloader-för-varje-bild
