10 Replies Latest reply on Feb 19, 2011 9:44 PM by AttaBoy2

    preloader problem

    AttaBoy2 Level 3

      I have a simple slide show that just used timeline tweening(no actionscript) named slideShow.swf

      I have another swf named loadSS.swf that I load slideShow.swf into this file has a preloader in it.

      I have a 3'rd swf named loadLoadSS.swf that simply loads loadSS.swf.

       

      The preloader in loadSS.swf works fine when I run it standalone.

      When I run loadLoadSS.swf the slideshow runs but the preloader doesn't.

       

      I don't want the preloader to run on the final destination because it's a website with a long timeline and many levels and the slideshow will be shown in many places and it just gets complicated.  If the slideshow can just provide it's own preloader life will be much simpler.

       

      slideShow.swf has no AS

      loadSS.swf has this AS:

      var mcLoader:MovieClipLoader = new MovieClipLoader();
      var listener:Object = new Object();
      var preloadPercent:Number;

      mcLoader.addListener(listener);

      listener.onLoadProgress = function(target_mc:MovieClip, loadedBytes:Number, totalBytes:Number) {
          preloadPercent = Math.round((loadedBytes/totalBytes) * 100);
          _root.preloader.preload_bar._xscale = preloadPercent;
          if(preloadPercent > 99){_root.preloader._visible = false;}
      //     trace("preloadPercent "+preloadPercent);
      };

      mcLoader.loadClip("slideShow.swf", 2);
                   

      loadLoadSS has this AS:

      var mcLoader:MovieClipLoader = new MovieClipLoader();

      mcLoader.loadClip("loadSS.swf", 2);

       

      links:

       

      slideShow.swf

      loadSS.swf

      loadLoadSS.swf

        • 1. Re: preloader problem
          kglad Adobe Community Professional & MVP

          in loadSS, add

           

          this._lockroot=true;

          • 2. Re: preloader problem
            AttaBoy2 Level 3

            nope tried that already and tried again just to be sure, no luck

            • 3. Re: preloader problem
              kglad Adobe Community Professional & MVP

              copy and paste your loadSS code

              • 4. Re: preloader problem
                AttaBoy2 Level 3

                I did it's on this page.


                • 5. Re: preloader problem
                  kglad Adobe Community Professional & MVP

                  there's no _lockroot property assigned.


                  • 6. Re: preloader problem
                    AttaBoy2 Level 3

                    I posted this after I took it out and before I put it back in this is how it looks currently:

                     

                    this._lockroot=true;
                    var mcLoader:MovieClipLoader = new MovieClipLoader();
                    var listener:Object = new Object();
                    var preloadPercent:Number;

                     

                    mcLoader.addListener(listener);

                     

                    listener.onLoadProgress = function(target_mc:MovieClip, loadedBytes:Number, totalBytes:Number) {
                        preloadPercent = Math.round((loadedBytes/totalBytes) * 100);
                        preloader.preload_bar._xscale = preloadPercent;
                        if(preloadPercent > 99){preloader._visible = false;}
                    //     trace("preloadPercent "+preloadPercent);
                    };

                    • 7. Re: preloader problem
                      AttaBoy2 Level 3

                      I think I understand your concern with this._lockroot=true; now earlier I'd prefeced preloader with _root in an attempt to control a graphic on the top level swf.

                      That attempt failed and I forgot to remove the _root, oddly enough it made no difference.  Anyway what you see now is what is online.

                      • 8. Re: preloader problem
                        kglad Adobe Community Professional & MVP

                        that code doesn't need _lockroot.  what's the following trace show:

                         


                        var mcLoader:MovieClipLoader = new MovieClipLoader();
                        var listener:Object = new Object();
                        var preloadPercent:Number;

                         

                        mcLoader.addListener(listener);


                        trace(preloader+" "+preloader.preload_bar)

                         

                        listener.onLoadProgress = function(target_mc:MovieClip, loadedBytes:Number, totalBytes:Number) {
                            preloadPercent = Math.round((loadedBytes/totalBytes) * 100);
                            preloader.preload_bar._xscale = preloadPercent;
                            if(preloadPercent > 99){preloader._visible = false;}
                        //     trace("preloadPercent "+preloadPercent);
                        };

                        1 person found this helpful
                        • 9. Re: preloader problem
                          AttaBoy2 Level 3

                          _level0.preloader _level0.preloader.preload_bar
                          _level0.preloader _level0.preloader.preload_bar
                          _level0.preloader _level0.preloader.preload_bar
                          _level0.preloader _level0.preloader.preload_bar
                          _level0.preloader _level0.preloader.preload_bar
                          _level0.preloader _level0.preloader.preload_bar
                          _level0.preloader _level0.preloader.preload_bar
                          _level0.preloader _level0.preloader.preload_bar
                          _level0.preloader _level0.preloader.preload_bar
                          _level0.preloader _level0.preloader.preload_bar
                          _level0.preloader _level0.preloader.preload_bar
                          _level0.preloader _level0.preloader.preload_bar
                          _level0.preloader _level0.preloader.preload_bar
                          _level0.preloader _level0.preloader.preload_bar
                          _level0.preloader _level0.preloader.preload_bar
                          _level0.preloader _level0.preloader.preload_bar
                          _level0.preloader _level0.preloader.preload_bar
                          _level0.preloader _level0.preloader.preload_bar
                          _level0.preloader _level0.preloader.preload_bar
                          _level0.preloader _level0.preloader.preload_bar
                          _level0.preloader _level0.preloader.preload_bar
                          _level0.preloader _level0.preloader.preload_bar

                           

                          when running loadSS.swf

                           

                          nothing displays when nunning  loadLoadSS.swf

                           

                          when I run the trace I commented out in the example it traces out the load percentage with both swfs

                          • 10. Re: preloader problem
                            AttaBoy2 Level 3

                            I got it working with your help ..thanks!

                             

                            var mcLoader:MovieClipLoader = new MovieClipLoader();
                            var listener:Object = new Object();
                            var preloadPercent:Number;

                             

                            this.createEmptyMovieClip("holder", this.getNextHighestDepth());

                             

                            mcLoader.addListener(listener);

                             

                            listener.onLoadProgress = function(target_mc:MovieClip, loadedBytes:Number, totalBytes:Number) {
                                preloadPercent = Math.round((loadedBytes/totalBytes) * 100);
                                preloader.preload_bar._xscale = preloadPercent;
                                if(preloadPercent > 99){preloader._visible = false;}
                            //     trace("preloadPercent "+preloadPercent);
                            trace(preloader+" "+preloader.preload_bar);
                            //this.swapDepths(_root.getNextHighestDepth());
                            };

                             

                            mcLoader.loadClip("slideShow.swf", holder);