10 Replies Latest reply on Apr 12, 2010 9:51 PM by kglad

    loading clips into loadmovienum.. trying to make load in background

    drnen

      I swear that this was working earlier but i must have changed something because now it isnt. I have a few clips that im trying to have load in the background without actually being visible upon initial load. To accomplish this i was going with something like this on the first frame of the main clip:

       

      loadMovieNum("dl_illustration.swf",4);
      _level4._visible = false;

       


      I SWEAR this same code was working just fine about 30 mins ago and now ive been playing with some other stuff and its not working anymore- the illustration clip just loads right over top of the main clip, basically ignoring my call for it to be invisible. Does anyone have ANY clue what is going on here?

        • 1. Re: loading clips into loadmovienum.. trying to make load in background
          kglad Adobe Community Professional & MVP

          you can't reference _level4 until it exists which won't occur until loading is complete.  ie, you'll need to use preloader code.

           

          but when loading is complete, no matter what else you do, everything in _level4 will appear above everything in _level0.

          • 2. Re: loading clips into loadmovienum.. trying to make load in background
            drnen Level 1

            i still cant get it to work :/

            I picked up some old preloader code from an old site. This is on frame 2 of the main movie:

             

            if (_root.getBytesLoaded() != _root.getBytesTotal()) { gotoAndPlay(1); } fill._xscale = ((_root.getBytesLoaded() / _root.getBytesTotal()) * 100); fill._yscale = ((_root.getBytesLoaded() / _root.getBytesTotal()) * 100); fill._alpha = ((_root.getBytesLoaded() / _root.getBytesTotal()) * 100)+20; prcnt_done = Math.round((_root.getBytesLoaded() / _root.getBytesTotal()) * 100) + "%";

             

            And for the loading of the 2nd clip i have on frame 1:

            level4.visible=false;

             

            and on frame 3 i have:

            loadMovieNum("dl_illustration.swf",4);

             

            still behaving the same way it was before.. im lost

            • 3. Re: loading clips into loadmovienum.. trying to make load in background
              kglad Adobe Community Professional & MVP

              you have to preload _level4, not _root:

               

              on frame 1:

               

              fill._xscale=0;

              loadMovieNum("dl_illustration.swf",4);


              this.onEnterFrame=function(){

              var lb:Number=_level4.getBytesLoaded();

              var tb:Number=_level4.getBytesTotal();

              if(bl>0){

              var loaded:Number = 100*bl/bt

              fill._xscale = loaded;  // assuming there's something on-stage with instance name fill

              prcnt_done.text=loaded+"% Loaded"; // assuming there's a textfield with instance name prcnt_done on-stage

              if(bl>=bt){

              delete this.onEnterFrame

              // loading is complete.  do whatever

              }

              }

              }

               

              p.s.  the _visible property is reset in load-targets so it's not usable to hide loading swfs/images.  you can use the _alpha property because that's not reset in load-targets.  but, again, the target has to exist before you can reference it.  your best solution, if you want to use _level4, is to place an empty keyframe in your external swf in frame 1 and attach a stop() to that frame.  after loading is complete, apply a play() method to _level4 when you want it to play.

              • 4. Re: loading clips into loadmovienum.. trying to make load in background
                drnen Level 1

                you are quite brilliant mr kglad just in case no one has told you that today. Thank you much- i just used that code and adapted it to preload the other clips that i needed as well and it seems to be working across the board. The proloader itself was kinda placeholder just as i worked through my issues so hopefully i dont bone it all up when i go to the finished version (thinking of doing a nice bar loader). But hopefully i dont do anything wrong! thanks a million again for the help!!

                • 6. Re: loading clips into loadmovienum.. trying to make load in background
                  drnen Level 1

                  I think i spoke too soon.. it isnt working properly for me :/

                  this code works but only after the page is refreshed.. I know you know exactly what you're doing i'm just not doing it properly. I wish this site offered an easy way to upload a file and id send you what i have.

                  I'm going to work on it more tonight and try to get in a final preloader at least and then I will regroup with you if you arent bored with me yet.

                  • 7. Re: loading clips into loadmovienum.. trying to make load in background
                    drnen Level 1

                    i found some simple code online that ALMOST gets me there..

                    on the main movie, first frame i have:

                    loadMovieNum("dl_web.swf", 3);
                    loadMovieNum("dl_illustration.swf", 4);
                    loadMovieNum("dl_retouching.swf", 5);

                     

                    and also on the main movie, each button has the following code attached:

                    on(release){   
                         _level3.gotoAndPlay(2);
                        _level3._visible = true;

                     

                     

                    And on each of the files being called to, on the first frame i have:

                    stop();
                    onEnterFrame = function(){
                        if (_root.getBytesLoaded() == _root.getBytesTotal()){
                            delete onEnterFrame;
                        }
                    }
                        _level3._visible = false;

                     

                    Level callouts vary for each movie, 3-5. The levels are the only numbers that are changing. The problem is that even though the code for all 3 files looks exactly the same to me, no matter what i do, i cannot get the code on level 3 to work.  As soon as the main movie loads, it just plays level 3 automatically. The other 2 remain invisible until i click on their respective buttons. I've stared at the code for an hour and i cant for the life of me figure out what is different about that one clip

                     

                    any ideas?

                    • 8. Re: loading clips into loadmovienum.. trying to make load in background
                      kglad Adobe Community Professional & MVP

                      you should place an empty keyframe in frame 1 of each of your loaded swfs and then add:

                       

                      stop()

                       

                      to that first empty frame.

                       

                      then in your main swf, you can apply:

                       

                      _level3.play();

                       

                      when you want the swf loaded into _level3 to play and become visible.

                      • 9. Re: loading clips into loadmovienum.. trying to make load in background
                        drnen Level 1

                        always way less complicated than i try to make it

                        think im good for now. thanks again for the patience and the help!