8 Replies Latest reply on Oct 19, 2009 7:16 AM by StresseDennis

    Need a peloader for a diffirent kind of file!

    StresseDennis

      Hi there,

      I need to make a preloader for a test project that is very diffirent and  a little bit off-beat as it uses script that I have prostetuted from a variety of diffirent files, see (http://www.urbanbullet.co.za/preview/nmmu_explorer.swf might take a while to load as it has no preloader :) and please note how it does load...), it scrolls the actual content of the site along the x axis in multiple speeds by using the following script 4 times for each layer/speed of content:


      xpos = getProperty( _root.mainscroller.scrollerbg, _x);

      xpos2 = xposnew-xpos;

      xmove = xpos2/_root.speed4;

      setProperty( _root.mainscroller.scrollerbg, _x, xpos+xmove);


      The layers all travel at diffirent speeds and the content that is displayed are external .png's and .swf's

      that load into four diffirent layer using their own loadMovie script that looks like this:

      loadMovie("content/01ExploreNMMU/exploreNMMU.swf","clip1");
      loadMovie("content/02CampusLIFE/campusLIFE.swf","clip2");
      loadMovie("content/03StudyNMMU/studyNMMU.swf","clip3");
      loadMovie("content/04Research/research.swf","clip4");
      loadMovie("content/05ContactUs/contactus.swf","clip5");
      loadMovie("content/06Downloads/downloads.swf","clip6");
      loadMovie("content/07Community/community.swf","clip7");

      and on one of the other layers uses the same function but pulls .png's"

      loadMovie("content/slider_images/mg/exploreMg.png","clip8");
      loadMovie("content/slider_images/mg/campusMg.png","clip9");
      loadMovie("content/slider_images/mg/studyMg.png","clip10");
      loadMovie("content/slider_images/mg/researchMg.png","clip11");
      loadMovie("content/slider_images/mg/contactMg.png","clip12");
      loadMovie("content/slider_images/mg/downloadsMg.png","clip13");
      loadMovie("content/slider_images/mg/comunityMg.png","clip14");

      etc.

      The actual files they are pulling are massive in file size and there fore I need to make a preloader that can cach all the content and then start to display the actual 'content/sliders' I dont even have an idea what kind of loader to use for something like this as I have already tried adding a little loading function (what the "clip1" "clip2" etc...) either I am making this to big of an issue and there is a realy simple way of doing this or there is none that will do what I require???
      does anyone know of a way for me to pre load everything with one preloader simotaniously?

      If you would like the master .fla (1.25mb)? (does not include content or the other file) please follow this link http://www.urbanbullet.co.za/preview/download.zip .

      Your help is greatly appreciated! and Thank you in advance!!!


      email rps@live.co.za if you would like to discuss something in private.

        • 1. Re: Need a peloader for a diffirent kind of file!
          Ned Murphy Adobe Community Professional & MVP

          If you are loading external content, you have only a couple of choices of load methods, and the time it takes to load them isn't anything you can control.  Your best bet will probably be to load everything one after another using the MovieClipLoader.loadClip() method rather than loadMovie.  You can keep track of the loading progress as well as use an event listener to have the completion of one loading trigger another.  If you want to hold off displaying any of the loaded content until it is all loaded you can using the load completion final load completion to trigger making everything _visible or active.

          1 person found this helpful
          • 2. Re: Need a peloader for a diffirent kind of file!
            StresseDennis Level 1

            Hi Ned, first of all thank you for your reply. I have posted this same issue on an array of diffirent forum's and you are the only one who has replied in any of them.

             

            I am not concerned about the time the content takes to load, I just don't like the way it displays 'piece by piece' I am sure I can optimize the .png's a little bit more and get a reasonably smaller file size but I would love to find a way of preloading all the content simotaniously and then displaying... I am going to try the method you suggested and was wondering if you could give me a practical example of how to impliment that script?

             

            Thank you, once again, your input is greatly appreciated! -SD

            • 3. Re: Need a peloader for a diffirent kind of file!
              Ned Murphy Adobe Community Professional & MVP

              You simply cannot load everything simultaneously, so your best bet is to load it in a controlled manner and hide it until it's ready to all be displayed.

               

              If you look up the addListener method of the MovieClipLoader class in the AS2 help documents, there is an example there that shows how to use the class and the various features that support it.  You will be looking for the onLoadComplete event rather than the onLoadInit event, who's handler function you will use to hide the object just loaded and to intiate the next loading.

               

              You will probably find it useful to store a reference to each loaded object in array so that you can loop thru that array after all loading is complete and have everything display. Just as a thought worrth considering... if you were to load everything into a single container (an empty movieclip), you could make that movieclip invisible at the start and not have to deal with making individual loaded pieces invisible... once the last item completes loading you just make that container visible and everything displays at once.

              • 4. Re: Need a peloader for a diffirent kind of file!
                StresseDennis Level 1

                Hi again Ned, and thank you. It's great to get a reply on this issue, I am going to try the method you suggested and I will let you know if I get it to function. ...why didn't I think of using adobes forums a long time ago... much more helpful then the other random places I subscribe to. Thank you!

                • 5. Re: Need a peloader for a diffirent kind of file
                  StresseDennis Level 1

                  Okay, I am still stuck. Could I ask you a huge favour? If you have a second could you please take a look at my file http://www.urbanbullet.co.za/preview/download.zip I have read into the AS 2.0 help documentation on how to use the MovieClipLoader class as well as how to add an eventListener but I can not seem to make it function on my project? I would love to get this to work on my own but I have spent 4 days on this section and I am wondering if it is even possible to use this function in the way my document is set up?

                   

                  here is a break down of how my file works:

                   

                  The AS in the first fram of my documents main timeline:

                   

                  stop();

                   

                  // _root.imagewidth defines the width of the image//
                  _root.imagewidth = 999,5;

                   

                  // _root.speed defines the speed of the sliding images//
                  _root.speed = 10;
                  _root.speed4 = 30;


                  /* _root.trig.xposnew defines the x position of the
                  sliding images */
                  _root.trig.xposnew = -(_root.imagewidth);
                  _root.trig2.xposnew = -(_root.imagewidth);
                  _root.trig3.xposnew = -(_root.imagewidth);
                  _root.trig4.xposnew = -(_root.imagewidth);

                   

                  // Explore NMMU
                  but1.onRelease = function() {
                  _root.trig.xposnew = -(_root.imagewidth);
                  _root.trig2.xposnew = -(_root.imagewidth);
                  _root.trig3.xposnew = -(_root.imagewidth);
                  _root.trig4.xposnew = -(_root.imagewidth);
                  };

                  // Campus Life
                  but2.onRelease = function() {
                  _root.trig.xposnew = -((_root.imagewidth)*2);
                  _root.trig2.xposnew = -((_root.imagewidth)*2);
                  _root.trig3.xposnew = -((_root.imagewidth)*2);
                  _root.trig4.xposnew = -((_root.imagewidth)*2);
                  };

                  // Studdy Nmmu
                  but3.onRelease = function() {
                  _root.trig.xposnew = -((_root.imagewidth)*3);
                  _root.trig2.xposnew = -((_root.imagewidth)*3);
                  _root.trig3.xposnew = -((_root.imagewidth)*3);
                  _root.trig4.xposnew = -((_root.imagewidth)*3);
                  };

                  // Research
                  but4.onRelease = function() {
                  _root.trig.xposnew = -((_root.imagewidth)*4);
                  _root.trig2.xposnew = -((_root.imagewidth)*4);
                  _root.trig3.xposnew = -((_root.imagewidth)*4);
                  _root.trig4.xposnew = -((_root.imagewidth)*4);
                  };

                  // Contact Us
                  but5.onRelease = function() {
                  _root.trig.xposnew = -((_root.imagewidth)*5);
                  _root.trig2.xposnew = -((_root.imagewidth)*5);
                  _root.trig3.xposnew = -((_root.imagewidth)*5);
                  _root.trig4.xposnew = -((_root.imagewidth)*5);
                  };

                  // Downloads
                  but6.onRelease = function() {
                  _root.trig.xposnew = -((_root.imagewidth)*6);
                  _root.trig2.xposnew = -((_root.imagewidth)*6);
                  _root.trig3.xposnew = -((_root.imagewidth)*6);
                  _root.trig4.xposnew = -((_root.imagewidth)*6);
                  };

                  // Comunity
                  but7.onRelease = function() {
                  _root.trig.xposnew = -((_root.imagewidth)*7);
                  _root.trig2.xposnew = -((_root.imagewidth)*7);
                  _root.trig3.xposnew = -((_root.imagewidth)*7);
                  _root.trig4.xposnew = -((_root.imagewidth)*7);
                  };

                   

                  The AS that controlls the 'Trigger'

                   

                  /* Foreground Scroller */

                   

                  xpos = getProperty(_root.foregroundscroller.scrollerfg, _x);

                  xpos2 = xposnew-xpos;

                  xmove = xpos2/_root.speed;

                  setProperty(_root.foregroundscroller.scrollerfg, _x, xpos+xmove);

                   

                  /* Mid Scroller */

                   

                  xpos = getProperty(_root.midscroller.scrollermg, _x);

                  xpos2 = xposnew-xpos;

                  xmove = xpos2/_root.speed2;

                  setProperty(_root.midscroller.scrollermg, _x, xpos+xmove);

                   

                  /* Far Mid Scroller */

                   

                  xpos = getProperty(_root.midbackgroundscroller.scrollerfmb, _x);

                  xpos2 = xposnew-xpos;

                  xmove = xpos2/_root.speed3;

                  setProperty(_root.midbackgroundscroller.scrollerfmb, _x, xpos+xmove);

                   

                  /* Background Scroller */

                   

                  xpos = getProperty( _root.mainscroller.scrollerbg, _x);

                  xpos2 = xposnew-xpos;

                  xmove = xpos2/_root.speed4;

                  setProperty( _root.mainscroller.scrollerbg, _x, xpos+xmove);

                   

                  An example of one of the image holders AS: (foregroundscroller)

                   

                  /* Loading the images in their appropriate Movie Clips from the folder named as 'content' */

                  /* 01 Foreground Images */

                  loadMovie("content/01ExploreNMMU/exploreNMMU.swf","clip1");
                  loadMovie("content/02CampusLIFE/campusLIFE.swf","clip2");
                  loadMovie("content/03StudyNMMU/studyNMMU.swf","clip3");
                  loadMovie("content/04Research/research.swf","clip4");
                  loadMovie("content/05ContactUs/contactus.swf","clip5");
                  loadMovie("content/06Downloads/downloads.swf","clip6");
                  loadMovie("content/07Community/community.swf","clip7");

                   

                  /* Setting the x and y position of Movie Clips in which images are loaded */

                   

                  setProperty("clip1",_x,_root.imagewidth);
                  setProperty("clip1",_y,0);

                  setProperty("clip2",_x,_root.imagewidth*2);
                  setProperty("clip2",_y,0);

                  setProperty("clip3",_x,_root.imagewidth*3);
                  setProperty("clip3",_y,0);

                  setProperty("clip4",_x,_root.imagewidth*4);
                  setProperty("clip4",_y,0);

                  setProperty("clip5",_x,_root.imagewidth*5);
                  setProperty("clip5",_y,0);

                  setProperty("clip6",_x,_root.imagewidth*6);
                  setProperty("clip6",_y,0);

                  setProperty("clip7",_x,_root.imagewidth*7);
                  setProperty("clip7",_y,0);

                   

                   

                  I am really stressed out on this one! Wish I had more time to research this issue, and learn out of it but I am not getting anywhere? Any other help you could give me would be greatly appreciated! I realy just don't know where or how to implimetn the AS for the Listener to work correctly?

                   

                   

                  Should I change;  loadMovie("content/01ExploreNMMU/exploreNMMU.swf","clip1"); to

                  foregroundscroller.loadClip("content/01ExploreNMMU/exploreNMMU.swf", img_mc);ad

                   

                  I am realy lost. Thanks again for your time.

                   

                   

                  • 6. Re: Need a peloader for a diffirent kind of file!
                    StresseDennis Level 1

                    I keep getting a error message: The property being referenced does not have the static attribute. on this AS: MovieClipLoader.loadClip() ??? I am so stressed out! Don't think this is going to do the trick... :/

                    • 7. Re: Need a peloader for a diffirent kind of file!
                      Ned Murphy Adobe Community Professional & MVP

                      Your best bet will be to start small and work up to your goal.  RAther then stressing with getting it working in your file from the start, begin with a separate file, just loading one file, then a couple.  By taking your time and learning how to do it, you will be in a better position to get it done.

                      1 person found this helpful
                      • 8. Re: Need a peloader for a diffirent kind of file!
                        StresseDennis Level 1

                        Hi again, that's not a bad idea! I realy just do not want to experiment for days and then realise that it's not going to work... I am all for learning! And think I am going to pull an all nighter tonight, as I realy can not aford to lose more time on this part of the development, all I realy need to know is that at the end of the day it is possible to use the LoadMovieClip class in my document as it is currently? (http://www.urbanbullet.co.za/preview/nmmu_explorer.swf to view or download the .fla http://www.urbanbullet.co.za/preview/download.zip) If you think I might run into problems - please let me know... Thank's again!