Home Tutorials Forums Articles Blogs Movies Library Employment Press
Old 05-19-2007, 12:12 AM   #1
Registered User
Join Date: May 2007
Posts: 1
Default Preload Images Loaded Through XML

I've created a slideshow that loads the images through xml and it works great, except when an image is not loaded before it's supposed to be display.

The slideshow is pretty small, so I want to preload all images upfront before the slideshow starts, and this is where I'm having problems.

I can get one image to preload fine, but when trying to get them all to load, everything I try doesn't work how I would expect.

Doing a for statement seems to only load the last image, and a while loop breaks the script.

Here's an example of what I've tried:

for (i = 0; i < totalSlides; i++) {			
	preloadImg = preloadSlideNode.attributes.path;
	preloadSlideNode = preloadSlideNode.nextSibling;
	onEnterFrame = function() {
		t  =  mc.getBytesTotal();
		l  =  mc.getBytesLoaded();
		if(t && l && t==l){
			delete onEnterFrame
            if (i == totalSlides) {
				alphaTween = new mx.transitions.Tween(whiteOut, "_alpha",mx.transitions.easing.Regular.easeOut,0,100,_global.fadetime,true);
Basically this would work if I could get it to wait until each image is loaded before starting the loop again.

Anyone have any suggestions?
joshbousel is offline   Reply With Quote
Old 05-19-2007, 12:38 AM   #2
Registered User
Join Date: Apr 2006
Posts: 22

try to use MovieClipLoader Class and detect the 'onLoadComplete' Event
fandlr is offline   Reply With Quote
Old 04-09-2008, 12:43 PM   #3
Registered User
Join Date: Apr 2008
Posts: 6

I've got exactly same problem, did you resolve this?
daramwalsh is offline   Reply With Quote
Old 04-09-2008, 12:54 PM   #4
Banned by AS.org Staff
Join Date: Jan 2007
Location: Montréal, Québec
Posts: 14,073

atomic is offline   Reply With Quote

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
AS3 Loaded XML into DataGrid chuckgrenade Flex 2, 3 & 4 11 03-27-2007 07:55 PM
Apply tween classes to dynamically loaded images!!! phencesgirl ActionScript 2.0 0 03-12-2007 06:46 PM
Turning Dynamically Loaded XML text string into a link harvestcry ActionScript 2.0 2 03-07-2007 02:29 AM
text field loaded through xml prob adamdaly ActionScript 2.0 5 02-25-2007 11:58 PM
Strange problem in creating a 360 model with dynamicly loaded images...? johnnyboy ActionScript 2.0 14 12-07-2005 07:03 PM

All times are GMT. The time now is 07:13 AM.

Follow actionscriptorg on Twitter


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.