1 Reply Latest reply on Jun 23, 2006 8:16 AM by DazFaz

    Image Chain Preloader

    GerritB
      Hi,

      I got this situation, where i need to load 5 external jpg files. I don't know where those are located, the location is retreived from an XML file.

      The problem is I want to load them all in one chain, but the preloader textbox needs to get their total size, and set that as 100%. So I don't want to see it load to 100% per image, but I want a preloader for the total, now I made this class to preload this, but there seems to be a problem with it, and I can't find it.

      What I try is to start preloading each image, to get its size, and immediately stop that, so far so good, but when I have the size of all images, I start loading them, and there something goes wrong.

      I'll explain the constructor a bit
      Preload(picArr:Array, targetArr:Array, progressF:Function, gotSizeF:Function, execDone:Function)
      - picArr = Array which contains the URLs to the pictures,
      - targetArr = Array which contains the target MovieClips for each picture (picArr[0] has target targetArr[0] etc...)
      - progressF = this function needs to be executed while preloading and is called in the onLoadProgress, this is to update the preloader textfield.
      - gotSizeF = this function is called when the size of all images is known, and adds this size to the total size of the swf itsself.
      - execDone = this function is called when the images are done preloading

      Here is the class Preload.as: