This content has been marked as final. Show 6 replies
I'm not sure exactly what you're describing.
You can either pre-cache images if the user has their browser cache enabled or you can preload them all into memory.
Either way, when loaded they need to go into a movieclip target. I don't tend to use Loader components to do that, I keep forgetting about that option, but it also comes with an overhead in terms of the size of the component.
If you want to preload all the thumbs for example into movieclips, you should perhaps check out David Stiller's MultiLoader class. Put those terms in google I'm sure it will get you there. [That's after you've loaded the xml with all the image urls though.]
I would like to preload all jpg's from an external file into Flash so they could be used without delay in a slide show using btns (next & prev). The trouble I'm running into is where to load them and how to load them.
In terms of where:
Well, for as2, you will probably need to load them as dynamically created child clips of a single parent clip that you use to display one swf from. You would cycle through them and just set the _visible property of your 'current' clip to true and all the others to false. Your next and previous buttons could change which one was visible.
But if they are large images, you'll probably use a lot of memory doing it this way and it would take longer to load them all at the start. Its more usual to, for example, load all the thumbnail images - smaller images, quicker to load - and then load the larger one into a main viewing area when its thumbnail is clicked.
There are plenty of examples of how to do this in tutorials etc.
If you want to load all the thumbnails first, then perhaps you won't find exactly what you want as a tutorial. Not every possibility is covered in a tutorial. All I can really do is point your in the right direction. If it were me I would use something like David Stiller's MultiLoader class to make it easier perhaps (in fact I have my own which works a little differently but was seriously inspired by what I learnt from David's article at http://www.quip.net/blog/2007/flash/actionscript-20/tracking-multiple-files-part1 & 2 )
Each jpg has to load into its own movieclip, eg jpg1_mc. You can preload each one separately before starting your app, or create a movieclip, container_mc, with them all in and just preload that one. Your buttons then have to target container_mc.jpg1_mc. I use the MovieClipLoader class.
Bob - fyi the MultiLoader class I mentioned is also a useful approach beyond using MovieClipLoaders directly - you might want to check it out too. It manages all the MovieClipLoaders for you, but you can still add listeners for each individual MovieClipLoader or check the progress for the whole group of clips you're loading. Its such a common thing to do that its useful to have a 'group loading' class like that.