2 Replies Latest reply on Jun 12, 2006 2:43 AM by Newsgroup_User

    Preload and Park

    Level 7
      Hi All,

      I am loading images using xml file. Its working fine the only problem is am
      facing is that client also need when first image is loading secound image
      should also load side by side so that when client click on next button they
      should not wait for longer period.

      Thanks in advance.


        • 1. Re: Preload and Park
          DazFaz Level 1
          for a better idea of your problem do you have the code that you are working with?
          • 2. Re: Preload and Park
            Level 7
            Hi DazFaz,

            Thanks for responding below is the code which i had used.

            CurLink = "fashion";
            recentLink = "";
            function loadXML(loaded) {
            if (loaded) {
            xmlNode = this.firstChild;
            image = [];
            total = xmlNode.childNodes.length;
            for (i=0; i<total; i++) {
            image = xmlNode.childNodes.childNodes[0].firstChild.nodeValue;
            }
            firstImage();
            } else {
            content = "file not loaded!";
            }
            }
            xmlData = new XML();
            xmlData.ignoreWhite = true;
            xmlData.onLoad = loadXML;
            _root.container.createEmptyMovieClip("image", 1);
            xmlData.load("portfolio/fashion.xml");
            function LoadPg(pg) {
            p = 0;
            recentLink = CurLink;
            _root[recentLink].gotoAndStop("off");
            CurLink = pg;
            //loadVars_out.sendAndLoad("vote.php", loadVars_in, "POST");
            xmlData.load("portfolio/"+pg+".xml");
            //loadVars_in.sendAndLoad(load ("portfolio/" + pg + ".xml");
            //gotoAndPlay ("play");
            //trace (pg);
            }

            listen = new Object();
            listen.onKeyDown = function() {
            if (Key.getCode() == Key.LEFT) {
            prevImage();
            } else if (Key.getCode() == Key.RIGHT) {
            nextImage();
            }
            };

            Key.addListener(listen);
            prev_btn.onRelease = function() {
            prevImage();
            };
            next_btn.onRelease = function() {
            nextImage();
            };

            _root.innerbar._visible = false;
            _root.percent="";
            this.onEnterFrame = function() {
            filesize = _root.container.image.getBytesTotal();
            loaded = _root.container.image.getBytesLoaded();
            _root.innerbar._visible = true;
            _root.percent = "";
            if (loaded != filesize) {
            _root.innerbar._xscale = loaded/filesize*100;
            _root.percent = Math.round((loaded / filesize) * 100)+" %";
            //trace ("inner loading");
            } else {
            _root.innerbar._visible = false;
            if (_root.container._alpha<100) {
            _root.container._alpha += 10;
            _root.percent = "";
            //trace ("inner loading done");
            }
            }
            };
            // code for next button starts here
            function nextImage() {
            if (p<(total-1)) {
            p++;
            if (loaded == filesize) {
            container._alpha = 0;
            var myLoader:MovieClipLoader = new MovieClipLoader();
            myLoader.addListener(this);
            myLoader.loadClip(image[p], _root.container.image);
            picture_num();
            }
            }
            }
            // code for next button ends here

            // code for back button starts here
            function prevImage() {
            if (p>0) {
            p--;
            container._alpha = 0;
            var myLoader:MovieClipLoader = new MovieClipLoader();
            myLoader.addListener(this);
            myLoader.loadClip(image[p], _root.container.image);
            picture_num();
            }
            }
            // code for next button ens here

            // this code loads first image starts here
            function firstImage() {
            if (loaded == filesize) {
            container._alpha = 0;
            var myLoader:MovieClipLoader = new MovieClipLoader();
            myLoader.addListener(this);
            myLoader.loadClip(image[0], _root.container.image);
            picture_num();
            }
            }
            // this code loads first image ends here

            function onLoadInit(target_mc:MovieClip) {
            // this is called after the image has completely loaded
            target_mc._x = -target_mc._width/2;
            target_mc._y = -target_mc._height/2;
            }
            firstImage();
            _root.container.onEnterFrame = function ()
            {
            if (_root.CurLink != "")
            {
            _root.menuMC[CurLink].gotoAndStop ("on");
            }
            if (_root.recentLink != "")
            {
            _root.menuMC[recentLink].gotoAndStop ("off");
            }
            };
            function picture_num() {
            current_pos = p+1;
            currnos = current_pos+" / "+total;
            }
            stop();


            Thanks



            "DazFaz" <webforumsuser@macromedia.com> wrote in message
            news:e6bj0i$oqa$1@forums.macromedia.com...
            > for a better idea of your problem do you have the code that you are
            working with?