This content has been marked as final. Show 17 replies
if you can live with a possibly erratic load status (because flash limits the number of simultaneous downloads) and your target movieclips are stored in an array that you pass to preloadF(), you can use:
Kglad, thanks for answering. It appears as though your loop would just load each individual move clip and then each loaded amount is shown for each clip. I'm wondering how I would go about having a preloader load all the movies and show just one total for all of them. is this possible?
that's what my code would do IF you were loading them all simultaneously. you can try and load them at the same time but, as i mentioned above, i believe flash will stagger their loading to allow no more than 5 simultaneous downloads and you'll therefore see bt increase from the start of your load statements until the last batch starts to load.
i'm sorry kglad, i misread the code. i'll give it a try and see what i can do with it. thanks again.
I'm having a little bit of a problem now. I've made preloader w/ your code in it except I the getByte() returns are coming back undefined. My images are genereated from a url inside of an xml file. In the rest of my movie I use
loadMovie('images/' + allGalleryData .firstChild.nextSibling.nextSibling.nextSibling.firstChild);
I call your preloader function like this preloaderF(allGalleryData);
so how would I actually link the bl or bt to the image itself? I've tried using
bt = ('/images' + allGalleryData.firstChild.nextSibling.nextSibling.nextSibling.firstChild.getBytesTotal());
but it doesn't work.
it just returns "/images"
any suggestions?? can i somehow put the entire url in there? or set something equal to that url and use like url.getBytesTotal() for example?
use the attach code option to display actionscript. among other problems this forum interprets [ i ] as encoding for italic font which why you last message is displayed incorrectly.
that said, i don't see a target movieclip into which you're loading your images.
kglad, yeah sorry I noticed that my code was in italics all of a sudden. Anyway, later on in the actual movie, not in the preloader, I use loadMovie("the url") and have a movie clip that i am attaching it to. Is there a way that i could load it into an empty movie clip for the time being and then in the actual movie just attach to that other movie clip? I'm using Flash MX so I don't think that I have the ability to use loadEmptyMovie() or whatever it is.
Or, is there a way that I can load the images and movieclips just as I would w/o a preloader but to make the clips not visible until all the images have preloaded and then I'd just have the preloader running on top of them?
Thanks for all of your help!
Here's the code for the preloader (I know it's incorrect):
using actionscript you can't load anything into your swf WITHOUT using a target. if you're loading jpgs, you must use a target movieclip or _level.
the preloadF() i gave you uses (as a parameter, mcA) an array of those target movieclips into which you should be loading your images.
i'm not sure what you want to do about "attaching" your pics, but you cannot attach (using attachMovie or attachSound or attachBitmap) anything that's doesn't have a linkage id and that means it must be in your swf's library in the authoring environment. ie, there's no such thing as dynamic or runtime "attaching".
Kglad, I'm actually attaching the movie clips in a different frame other than the preloader, can I do this? i dont even know if i'm partially on the right track.
here's my fla if it would help to see what the heck i'm trying to do... i know it's a mess right now. it works if you leave in the block comments on the first frame.
xml is here:
if they don't work please copy and paste url into your browser.
i really appreciate your help so far. THANKS!
I've been playing with preloaders lately. Mostly, for slide presentations so I've only been interested in preloading the next slide, but I have found that I like MCL and ListenerObjects for the task and I've put together a bit of code (I haven't tested it yet). That I think will download all of your images and keep the maximum number of simultaneous downloads to a minimum (1). Here's the code for your perusal.
that may or may not work, but unfortunately im' using flash mx, not mx 2004. As a result i don't have access to the function createEmptyMovieClip() or the MovieClipLoader() class. I'm trying to play with the method you have there, but haven't had any luck so far...I'm about ready to just say screw the preloader...
How odd is that. The createEmptyMovieClip() method of the MovieClip class was available in Flash 6 (Also known as Flash MX). It is true that the MovieClipLoader class was not available until MX04.
And as Kglad said, there is no way to load things without loading them into some kind of target. So you can load into movieclips that are hidden or something, but cannot load into movieclips that don't yet exist.
I tend to think of this classic problem in a slightly different way. To my mind the preloader isn't there to necessarily show how many bytes have been loaded and how many remain. I tend to think it is communicating that progress is being made – variable internet traffic, server load, etc. can mean that the datarate will fluctuate. So if you are loading several files that are roughly the same size (say within an order or magnitude) just advance the preloader for each file loaded.
Say you were loading 9 files total, then each file loaded would be about 11 percent (file percent = 1 / total number of files).
Just a different way of thinking about it. Maybe it will give you some ideas.
Well, I tried the whole attaching movieclip thing. This is done exactly the same way as I did in the movie itself and that works perfectly. It loads all the images just as they should and attach them fine, but when I try to do use the same concept to attach the jpgs to an invisible movieclip my bt and bl are still coming back as undefined. what am i still missing? i think i'm close to being on the right track but can't quite figure it out. Thanks for all your help guys.
any movieclip you can attach is already completely loaded when you execute attachMovie(). that's why you exported it for actionscript so it would be loaded (into the user's cache) and ready to appear on-stage as soon as you execute your attachMovie() statement.
so, there's no reason to use the getBytesLoaded() or getBytesTotal() methods of newPiece.
i'm so close to finally getting this thing to work. I got it to load the images , but unfortunately they are not loading to the correct clip and 'bl' and 'bt' are still undefined. I have a movie clip on the stage that is supposed to be an invisible clip (blank first frame w/ a stop() on it and the clip to load the image into on the second frame) that the image is supposed to load to. But when I use loadMovie it generates a new empty_mc.emptyImageHolder_mc clip instead of the one I placed on the stage. Am I attaching it wrong? This could also be then why my bl and bt are not displaying. So close and just can't quite seem to get it THANKS FOR ALL OF YOUR HELP. Especially you KGLAD!
empty_mc.emptyImageHolder_mc must exist (on-stage) when you execute your loadMovie() statement using the above as the target.
if empty_mc is on stage but its child clip emptyImageHolder is not (because it's in frame 2 of empty_mc and frame 2 has not played when your loadMovie() statement executes), then your loadMovie() statement will fail.