2 Replies Latest reply on May 11, 2007 12:49 PM by Nathan_Aaron

    External JPG preloader

    Nathan_Aaron
      Hey all! I could use any help you can give me pertaining to the need for an external JPG preloader.

      Check out my site at www.nathanaaron.com - go to menu/portfolio/print (for example.) As you can see as you scroll through the images, they take a bit of time to load, making you think nothing is happening. I have a preloader in the movie file; but it's calling external JPG files, so it is not preloading those. I'm a bit of a simpleton when it comes to actionscripting, so any help would be GREAT! And yes, I have searched and searched online, but just honestly can't understand what I'm trying to do here. Thanks!
        • 1. Re: External JPG preloader
          Simon Bailey
          movie clip loader

          Dunno what your using to load the images but if you use the MovieClipLoader class then you can utilise the onLoad listeners for a progress bar.

          Cheers Simon
          • 2. Re: External JPG preloader
            Nathan_Aaron Level 1
            The overall preloader I'm using for loading the portfolio swf is:

            stop();
            onEnterFrame = function () {
            totalBytes = _parent.getBytesTotal();
            loadedBytes = _parent.getBytesLoaded();
            percent = Math.ceil((loadedBytes/totalBytes)*100);
            gotoAndStop(percent);
            info_txt.text = percent+" %";
            if (percent>=100) {
            _parent.gotoAndPlay("illus");
            }
            };

            But again, this doesn't load the external JPGS. The code I have that is loading the JPGS (one at a time) is:


            this.pathToPics = "";
            this.pArray = ["Port_SP_Illustration.jpg", "ILL_TPMC_Elf.jpg", "Ill_wine.swf", "Ill_red.jpg", "IL_art_cake.jpg", "Ill_satisfaction.swf", "Ill_mrproperty.jpg", "Ill_child.swf", "IL_art_asbig_fade.swf", "IL_art_asbig_02.jpg", "IL_art_asbig_03.jpg", "IL_art_asbig_04.jpg", "Ill_chorus.jpg", "Ill_baby.swf", "Ill_father.swf"];
            this.fadeSpeed = 10;
            this.pIndex = 0;

            loadMovie(this.pathToPics+this.pArray[0], _root.photo);
            MovieClip.prototype.changePhoto = function(d) {

            this.pIndex = (this.pIndex+d)%this.pArray.length;
            if (this.pIndex<0) {
            this.pIndex += this.pArray.length;
            }
            this.onEnterFrame = fadeOut;
            };
            MovieClip.prototype.fadeOut = function() {
            if (this.photo._alpha>this.fadeSpeed) {
            this.photo._alpha -= this.fadeSpeed;
            } else {
            this.loadPhoto();
            }
            };
            MovieClip.prototype.loadPhoto = function() {
            // specify the movieclip to load images into
            var p = _root.photo;
            //------------------------------------------
            p._alpha = 0;
            p.loadMovie(this.pathToPics+this.pArray[this.pIndex]);
            this.onEnterFrame = loadMeter;
            };
            MovieClip.prototype.loadMeter = function() {
            var i, l, t;
            l = this.photo.getBytesLoaded();
            t = this.photo.getBytesTotal();
            if (t>0 && t == l) {
            this.onEnterFrame = fadeIn;
            } else {
            trace(l/t);
            }
            };
            MovieClip.prototype.fadeIn = function() {
            if (this.photo._alpha<100-this.fadeSpeed) {
            this.photo._alpha += this.fadeSpeed;
            } else {
            this.photo._alpha = 100;
            this.onEnterFrame = null;
            }
            };

            with the forward button coded as:

            on (release) {
            _root.changePhoto(1);
            }



            (and back as:)


            on (release) {
            _root.changePhoto(-1);
            }

            MY issue is, I know coders hate designers; because I know I could use the movie clip loader class; but you know, honestly, I start reading about class and listeners and my brain pops! I just don't get it. I'm good at tweaking code, but creating it is another story all together.