6 Replies Latest reply on Dec 7, 2007 10:25 AM by Bob Pierce

    batch loading jpegs from external file

    superdk Level 1
      I would like to preload a batch jpegs from an external file (to make it easy for changes) - than use them in a slide-slide show using a movieClip holder or loader component. I can use this tutorial - http://www.oman3d.com/tutorials/flash/portfolio_2_bc/index.php
      But I don't what to have each jpeg loaded separately I want them to preload b4 using..

      What would be the best way to preload the external batch to use for a slide show with next btn and prev btn? I can't find any tutorials one this.

      Thanks for any help,
        • 1. Re: batch loading jpegs from external file
          Greg Dove Level 4
          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.]
          • 2. Re: batch loading jpegs from external file
            superdk Level 1
            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.
            • 3. Re: batch loading jpegs from external file
              Greg Dove Level 4
              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 )

              • 4. Re: batch loading jpegs from external file
                Bob Pierce Level 1
                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.
                • 5. Re: batch loading jpegs from external file
                  Greg Dove Level 4
                  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.