1 2 Previous Next 50 Replies Latest reply on Mar 15, 2011 4:47 PM by Flanders_ZA

    Nested clips for cacheAsBitmap using onLoadInit

    Flanders_ZA-IgqhAi

      Hi,

       

      I'm using cacheAsBitmap to create a gradient mask. The code I set up worked great and all was well but I soon discovered problems when cacheAsBitmap was being nullified when its parent mc was loaded into another mc. I read up on it and from what I understand, since I'm using the MovieClipLoader class, this code should be included in onLoadInit in the root mc (start_mc). Basically this is what I have: start_mc loads main_mc (target) and rollMask1 and roll1 are contained within main_mc.

       

      Here's the script for onLoadInit:    

       

      function onLoadInit(target){

           target.rollMask1.cacheAsBitmap = true;

           trace(target.rollMask1.cacheAsBitmap);

           target.roll1.cacheAsBitmap = true;

           target.roll1.setMask("rollMask1");

      }

       

      This isn't working. Trace returns undefined. As a simple test I replaced:

       

      target.rollMask1.cacheAsBitmap = true;

       

      with

       

      target.cacheAsBitmap = true;

       

      Trace returns true with the latter so it appears to be a problem in calling the nested clip within the target mc.

       

      Any ideas? This seems fairly simple to me but I'm at a loss here and I'm having one of those am-I-going-crazy moments.

       

      Any help much appreciated.

        • 1. Re: Nested clips for cacheAsBitmap using onLoadInit
          kglad Adobe Community Professional & MVP

          what's the following show:

           


           

          function onLoadInit(target){

          for(var s:String in target){

          trace(s+": "+target[s]);

          }

           

               target.rollMask1.cacheAsBitmap = true;

           

               target.roll1.cacheAsBitmap = true;

               target.roll1.setMask("rollMask1");

          }


          • 2. Re: Nested clips for cacheAsBitmap using onLoadInit
            Flanders_ZA-IgqhAi Level 1

            Hi Kglad,

             

            Trace on that returns nothing at all. Nothing appears in the output panel.

             

             

             

            Just thought I'd add what I originally had and what worked when placed in the target mc when tested independently from the start mc:

             

            rollMask1.cacheAsBitmap = true;

            roll1.cacheAsBitmap = true;

            roll1.setMask("rollMask1");

             

            Simple as that really. This is doing my head in!

            • 3. Re: Nested clips for cacheAsBitmap using onLoadInit
              kglad Adobe Community Professional & MVP

              your onLoadInit() is not executing or your target movieclip contains nothing.  show the code related to your mcl.

              • 4. Re: Nested clips for cacheAsBitmap using onLoadInit
                Flanders_ZA-IgqhAi Level 1

                Hi kglad,

                 

                I'm sure this all boils down to my novice level of expertise here but I'm not sure what you mean by the code relating to mcl.

                 

                In start_mc, I have a blank clip called Main_mc into which the target clip loads. As I mentioned, if I eliminate the extended path to cacheAsBitmap and instead apply it directly to the target clip it, works so to me it would suggest that the onLoadInit is executing?

                • 5. Re: Nested clips for cacheAsBitmap using onLoadInit
                  kglad Adobe Community Professional & MVP

                  show the code you use to load your swf.

                  • 6. Re: Nested clips for cacheAsBitmap using onLoadInit
                    Flanders_ZA-IgqhAi Level 1

                    var loader_mcl = new MovieClipLoader();
                    loader_mcl.addListener(this);

                     

                    function onLoadStart(target){
                        attachMovie("preloader Intro", "preloader_mc", 500, {_x:350, _y:245});
                        preloader_mc.endingClip.stop();
                    }

                     

                    function onLoadProgress(target, loadedBytes, totalBytes){

                         target.stop();
                         target._visible = false;
                         var StepUpBytes = totalBytes/100;
                         stepFrame = Math.floor(loadedBytes/StepUpBytes);
                         if(stepFrame<1){
                         stepFrame = 1;
                        }
                         preloader_mc.gotoAndStop(stepFrame+1); 
                    }

                     

                    function onLoadComplete(target){
                    preloader_mc.removeMovieClip();

                    }

                     

                    function onLoadInit(target){
                    //_level0.Main_mc = target;
                    target.rollMask1.cacheAsBitmap = true;
                    target.roll1.cacheAsBitmap = true;
                    target.roll1.setMask("rollMask1");
                    target.stop();
                    target._visible = false;
                    gotoAndStop(2);
                    }

                    • 7. Re: Nested clips for cacheAsBitmap using onLoadInit
                      kglad Adobe Community Professional & MVP

                      do you have a loadClip method applied to loader_mcl?


                      • 9. Re: Nested clips for cacheAsBitmap using onLoadInit
                        kglad Adobe Community Professional & MVP

                        lol.  well, then you're not going to load anything with your mcl and your onLoadInit() won't execute.  fix that.

                        • 10. Re: Nested clips for cacheAsBitmap using onLoadInit
                          Flanders_ZA-IgqhAi Level 1

                          kglad, the mcl does load the main clip. That part works. I'm probably just getting confused by your terminology but I assure you it is working. I've posted all the relevent code for that. The bit that isn't working is the part that relates to the cacheAsBitmap in onLoadInit. Also, the stuff not relevent to cacheAsBitmap in onLoadInit is also working so onLoadInit is definitely executing.

                          • 11. Re: Nested clips for cacheAsBitmap using onLoadInit
                            Flanders_ZA-IgqhAi Level 1

                            Oh, ps. - I was being a moron before (serious lack of sleep). loadClip code for loader_mc is:

                             

                            this.onEnterFrame = function  () {
                            startPreload("main.swf");
                            function startPreload(url){
                              loader_mcl.loadClip(url, Main_mc);
                                }
                            delete this.onEnterFrame;
                            }

                            • 12. Re: Nested clips for cacheAsBitmap using onLoadInit
                              kglad Adobe Community Professional & MVP

                              now, fix that code to:

                               


                              startPreload("main.swf");
                              function startPreload(url){
                                loader_mcl.loadClip(url, Main_mc);
                                  }

                               

                              and then copy and paste your updated mcl code with the trace statement.

                              • 13. Re: Nested clips for cacheAsBitmap using onLoadInit
                                Flanders_ZA-IgqhAi Level 1

                                If I remove the onEnterFrame function then my file no longer works and there is still no output.

                                • 14. Re: Nested clips for cacheAsBitmap using onLoadInit
                                  Flanders_ZA-IgqhAi Level 1

                                  Maybe this would be more productive if I emailed you the two files? Appreciate your help!

                                  • 15. Re: Nested clips for cacheAsBitmap using onLoadInit
                                    kglad Adobe Community Professional & MVP

                                    unless you want to hire me, copy and paste your updated mcl code with the trace statement.

                                    • 16. Re: Nested clips for cacheAsBitmap using onLoadInit
                                      Flanders_ZA-IgqhAi Level 1

                                      mcl code:

                                       

                                      startPreload("main.swf");
                                      function startPreload(url){
                                          loader_mcl.loadClip(url, Main_mc);
                                          }

                                       

                                      var loader_mcl = new MovieClipLoader();
                                      loader_mcl.addListener(this);

                                       

                                      function onLoadStart(target){
                                          attachMovie("preloader Intro", "preloader_mc", 500, {_x:350, _y:245});
                                          preloader_mc.endingClip.stop();
                                      }

                                       

                                      function onLoadProgress(target, loadedBytes, totalBytes){

                                           target.stop();
                                           target._visible = false;
                                           var StepUpBytes = totalBytes/100;
                                           stepFrame = Math.floor(loadedBytes/StepUpBytes);
                                           if(stepFrame<1){
                                           stepFrame = 1;
                                          }
                                           preloader_mc.gotoAndStop(stepFrame+1); 
                                      }

                                       

                                      function onLoadComplete(target){
                                      preloader_mc.removeMovieClip();

                                      }

                                       

                                       

                                      function onLoadInit(target){

                                           for(var s:String in target){

                                           trace(s+": "+target[s]);

                                           }

                                           target.rollMask1.cacheAsBitmap = true;

                                           target.roll1.cacheAsBitmap = true;

                                           target.roll1.setMask("rollMask1");

                                      }

                                       

                                      trace statement:

                                       

                                       

                                       

                                       

                                       

                                       

                                       

                                      • 17. Re: Nested clips for cacheAsBitmap using onLoadInit
                                        kglad Adobe Community Professional & MVP

                                        use:

                                         

                                        var loader_mcl = new MovieClipLoader();
                                        loader_mcl.addListener(this);

                                         

                                        startPreload("main.swf");
                                        function startPreload(url){
                                            loader_mcl.loadClip(url, Main_mc);
                                            }

                                         

                                         

                                         

                                        function onLoadStart(target){
                                            attachMovie("preloader Intro", "preloader_mc", 500, {_x:350, _y:245});
                                            preloader_mc.endingClip.stop();
                                        }

                                         

                                        function onLoadProgress(target, loadedBytes, totalBytes){

                                             target.stop();
                                             target._visible = false;
                                             var StepUpBytes = totalBytes/100;
                                             stepFrame = Math.floor(loadedBytes/StepUpBytes);
                                             if(stepFrame<1){
                                             stepFrame = 1;
                                            }
                                             preloader_mc.gotoAndStop(stepFrame+1); 
                                        }

                                         

                                        function onLoadComplete(target){
                                        preloader_mc.removeMovieClip();

                                        }

                                         

                                         

                                        function onLoadInit(target){

                                             for(var s:String in target){

                                             trace(s+": "+target[s]);

                                             }

                                             target.rollMask1.cacheAsBitmap = true;

                                             target.roll1.cacheAsBitmap = true;

                                             target.roll1.setMask("rollMask1");

                                        }

                                         


                                         

                                         

                                         

                                         

                                         

                                         

                                         

                                        • 18. Re: Nested clips for cacheAsBitmap using onLoadInit
                                          Flanders_ZA-IgqhAi Level 1

                                          Ah, now the clip works as per before when I had the onEnterFrame but the trace returns nothing (ie. output window does not even appear).

                                          • 19. Re: Nested clips for cacheAsBitmap using onLoadInit
                                            kglad Adobe Community Professional & MVP

                                            copy and paste the trace output from:

                                             


                                             

                                            var loader_mcl = new MovieClipLoader();
                                            loader_mcl.addListener(this);
                                            trace(this);

                                             

                                            startPreload("main.swf");
                                            function startPreload(url){

                                            trace("load  "+url+" "+Main_mc);
                                                loader_mcl.loadClip(url, Main_mc);
                                                }

                                             

                                             

                                             

                                            function onLoadStart(target){

                                            trace("LS");
                                                attachMovie("preloader Intro", "preloader_mc", 500, {_x:350, _y:245});
                                                preloader_mc.endingClip.stop();
                                            }

                                             

                                            function onLoadProgress(target, loadedBytes, totalBytes){

                                            trace("LP "+loadedBytes);

                                                 target.stop();
                                                 target._visible = false;
                                                 var StepUpBytes = totalBytes/100;
                                                 stepFrame = Math.floor(loadedBytes/StepUpBytes);
                                                 if(stepFrame<1){
                                                 stepFrame = 1;
                                                }
                                                 preloader_mc.gotoAndStop(stepFrame+1); 
                                            }

                                             

                                            function onLoadComplete(target){
                                            preloader_mc.removeMovieClip();

                                            }

                                             

                                             

                                            function onLoadInit(target){

                                            trace("LI "+target)

                                                 for(var s:String in target){

                                                 trace(s+": "+target[s]);

                                                 }

                                                 target.rollMask1.cacheAsBitmap = true;

                                                 target.roll1.cacheAsBitmap = true;

                                                 target.roll1.setMask("rollMask1");

                                            }

                                             


                                             

                                             

                                             

                                             

                                             

                                             

                                             

                                            • 20. Re: Nested clips for cacheAsBitmap using onLoadInit
                                              Flanders_ZA-IgqhAi Level 1

                                              Hi kglad,

                                               

                                              Here are the results:

                                               

                                               

                                               

                                              _level0
                                              load  main.swf _level0.Main_mc
                                              LS
                                              LP 85095
                                              LP 170759
                                              LP 270305
                                              LP 340235
                                              LP 408148
                                              LP 475705
                                              LP 544653
                                              LP 617308
                                              LP 687588
                                              LP 757024
                                              LP 829717
                                              LP 900719
                                              LP 971161
                                              LP 1050409
                                              LP 1129563
                                              LP 1211581
                                              LP 1302707
                                              LP 1392588
                                              LP 1484951
                                              LP 1588414
                                              LP 1671934
                                              LP 1774071
                                              LP 1863451
                                              LP 1948306
                                              LP 2062739
                                              LP 2063899
                                              LI _level0.Main_mc

                                              • 21. Re: Nested clips for cacheAsBitmap using onLoadInit
                                                kglad Adobe Community Professional & MVP

                                                so, roll1 doesn't exist in your loaded swf when onLoadInit() executes.  ie, it's not on-stage in main.swf's first frame.

                                                • 22. Re: Nested clips for cacheAsBitmap using onLoadInit
                                                  Flanders_ZA-IgqhAi Level 1

                                                  Hi kglad,

                                                   

                                                  roll1 through to roll4 exist on frame one of main.swf. They're all on one layer though and I thought this be causing the problem but doesn't seem to make any difference. I wanted to get roll1 working first before applying the code to the other 3. (I have individual masks for each of the rolls).

                                                   

                                                  Here is the temporary code again for main.swf to get it working there for now:

                                                   

                                                  rollMask1.cacheAsBitmap = true;
                                                  rollMask2.cacheAsBitmap = true;
                                                  rollMask3.cacheAsBitmap = true;
                                                  rollMask4.cacheAsBitmap = true;
                                                  roll1.cacheAsBitmap = true;
                                                  roll2.cacheAsBitmap = true;
                                                  roll3.cacheAsBitmap = true;
                                                  roll4.cacheAsBitmap = true;
                                                  roll1.setMask("rollMask1");
                                                  roll2.setMask("rollMask3");
                                                  roll3.setMask("rollMask2");
                                                  roll4.setMask("rollMask4");

                                                   

                                                  This works when testing main on its own.

                                                  • 23. Re: Nested clips for cacheAsBitmap using onLoadInit
                                                    kglad Adobe Community Professional & MVP

                                                    using the code i suggested, with the trace() statements, add the following to frame 1 of your loaded swf:

                                                     

                                                    trace("loaded swf");

                                                    for(var s:String in this){

                                                    trace(s+": "+this[s]);

                                                    }

                                                    trace(roll1);

                                                    trace("loaded swf");

                                                    • 24. Re: Nested clips for cacheAsBitmap using onLoadInit
                                                      Flanders_ZA-IgqhAi Level 1

                                                      loaded swf


                                                      onLoadInit: [type Function]
                                                      showtarget: [type Function]
                                                      onLoadComplete: [type Function]
                                                      onLoadProgress: [type Function]
                                                      onLoadStart: [type Function]
                                                      contactClip: _level0.Main_mc.contactClip
                                                      ContactBG: _level0.Main_mc.ContactBG
                                                      DesignClip: _level0.Main_mc.DesignClip
                                                      ConstructionClip: _level0.Main_mc.ConstructionClip
                                                      ProjManClip: _level0.Main_mc.ProjManClip
                                                      PropDevClip: _level0.Main_mc.PropDevClip
                                                      contactBut: _level0.Main_mc.contactBut
                                                      TopNav: _level0.Main_mc.TopNav
                                                      footer: _level0.Main_mc.footer
                                                      footer_L: _level0.Main_mc.footer_L
                                                      footer_R: _level0.Main_mc.footer_R
                                                      header_L: _level0.Main_mc.header_L
                                                      header_R: _level0.Main_mc.header_R
                                                      instance13: _level0.Main_mc.instance13
                                                      footer_mask: _level0.Main_mc.footer_mask
                                                      safeZone: _level0.Main_mc.safeZone
                                                      navMenu: _level0.Main_mc.navMenu
                                                      rollMask4: _level0.Main_mc.rollMask4
                                                      rollMask2: _level0.Main_mc.rollMask2
                                                      rollMask3: _level0.Main_mc.rollMask3
                                                      rollMask1: _level0.Main_mc.rollMask1
                                                      roll4: _level0.Main_mc.roll4
                                                      roll3: _level0.Main_mc.roll3
                                                      roll2: _level0.Main_mc.roll2
                                                      roll1: _level0.Main_mc.roll1
                                                      BackGround: _level0.Main_mc.BackGround
                                                      contact_mask: _level0.Main_mc.contact_mask
                                                      _level0.Main_mc.roll1
                                                      loaded swf
                                                      • 25. Re: Nested clips for cacheAsBitmap using onLoadInit
                                                        kglad Adobe Community Professional & MVP

                                                        where are the other traces?

                                                        • 26. Re: Nested clips for cacheAsBitmap using onLoadInit
                                                          Flanders_ZA-IgqhAi Level 1

                                                          Something's going wrong when applying the code exactly as you've provided (movie's not playing through properly) but I had neglected to issue all of the code I had in my onLoadComplete as I thought it was irrelevent because it's just a bunch of tweens -- but maybe I'm wrong. My full onLoadComplete:

                                                           

                                                          function onLoadComplete(target){
                                                          preloader_mc.removeMovieClip();
                                                          HeaderBarWaiting = new Tween(IntroHeader.HeaderBar,"_y", Regular.easeOut,0,0,10,false);
                                                          FooterWaiting = new Tween(footer,"_y", Regular.easeOut,footer._y,footer._y,25,false);
                                                          HeaderBarWaiting.onMotionFinished = function() {
                                                            HeaderBarPosition = new Tween(IntroHeader.HeaderBar,"_y", Regular.easeOut,getProperty(IntroHeader.HeaderBar,_y),-(Stage.height) + 92 ,15,false);
                                                            preloader_mc.gotoAndPlay(102);
                                                          }
                                                          FooterWaiting.onMotionFinished = function() {
                                                            FooterLeftPosition = new Tween(footer_L,"_y", Regular.easeOut,getProperty(footer_L,_y),(Stage.height) - 48 ,10,false);
                                                            FooterRightPosition = new Tween(footer_R,"_y", Regular.easeOut,getProperty(footer_R,_y),(Stage.height) - 48 ,10,false);
                                                            FooterPosition = new Tween(footer,"_y", Regular.easeOut,getProperty(footer,_y),(Stage.height) - 48 ,10,false);
                                                            bottomText._visible = true;
                                                            bottomText.gotoAndPlay(1);
                                                          }
                                                           
                                                          }

                                                           

                                                          If I run it from start, all I get is:

                                                           

                                                           

                                                          _level0
                                                          load  main.swf _level0.Main_mc
                                                          LS
                                                          LP 85095
                                                          LP 170759
                                                          LP 270312
                                                          LP 340239
                                                          LP 408155
                                                          LP 475709
                                                          LP 544661
                                                          LP 617311
                                                          LP 687600
                                                          LP 757030
                                                          LP 829679
                                                          LP 900731
                                                          LP 971170
                                                          LP 1050418
                                                          LP 1129573
                                                          LP 1211527
                                                          LP 1302711
                                                          LP 1392592
                                                          LP 1484952
                                                          LP 1588415
                                                          LP 1671933
                                                          LP 1774071
                                                          LP 1863455
                                                          LP 1948307
                                                          LP 2062540
                                                          LP 2063826
                                                          LI _level0.Main_mc

                                                           

                                                          If I run it from main with the code you provided for main:

                                                           

                                                           

                                                          loaded swf
                                                          onLoadInit: [type Function]
                                                          showtarget: [type Function]
                                                          onLoadComplete: [type Function]
                                                          onLoadProgress: [type Function]
                                                          onLoadStart: [type Function]
                                                          $version: WIN 8,0,22,0
                                                          __OnEnterFrameBeacon: _level0.__OnEnterFrameBeacon
                                                          contactClip: _level0.contactClip
                                                          ContactBG: _level0.ContactBG
                                                          DesignClip: _level0.DesignClip
                                                          ConstructionClip: _level0.ConstructionClip
                                                          ProjManClip: _level0.ProjManClip
                                                          PropDevClip: _level0.PropDevClip
                                                          contactBut: _level0.contactBut
                                                          TopNav: _level0.TopNav
                                                          footer: _level0.footer
                                                          footer_L: _level0.footer_L
                                                          footer_R: _level0.footer_R
                                                          header_L: _level0.header_L
                                                          header_R: _level0.header_R
                                                          instance8: _level0.instance8
                                                          footer_mask: _level0.footer_mask
                                                          safeZone: _level0.safeZone
                                                          navMenu: _level0.navMenu
                                                          rollMask4: _level0.rollMask4
                                                          rollMask2: _level0.rollMask2
                                                          rollMask3: _level0.rollMask3
                                                          rollMask1: _level0.rollMask1
                                                          roll4: _level0.roll4
                                                          roll3: _level0.roll3
                                                          roll2: _level0.roll2
                                                          roll1: _level0.roll1
                                                          BackGround: _level0.BackGround
                                                          contact_mask: _level0.contact_mask
                                                          _level0.roll1
                                                          loaded swf

                                                          • 27. Re: Nested clips for cacheAsBitmap using onLoadInit
                                                            kglad Adobe Community Professional & MVP

                                                            1.  with those trace() functions in main.fla publish a main.swf. 

                                                             

                                                            2.  test your fla that contains your moviecliploader and that loads main.swf from 1.

                                                             

                                                            3.  copy the output and paste it into this forum.

                                                            • 28. Re: Nested clips for cacheAsBitmap using onLoadInit
                                                              Flanders_ZA-IgqhAi Level 1

                                                              That's what I did. main.swf was published with this:

                                                               

                                                              trace("loaded swf");

                                                              for(var s:String in this){

                                                              trace(s+": "+this[s]);

                                                              }

                                                              trace(roll1);

                                                              trace("loaded swf");

                                                               

                                                              And then when I test start (the one with the moviecliploader and that loads main.swf) I get:

                                                               

                                                              _level0
                                                              load  main.swf _level0.Main_mc
                                                              LS
                                                              LP 85095
                                                              LP 170759
                                                              LP 270312
                                                              LP 340239
                                                              LP 408155
                                                              LP 475709
                                                              LP 544661
                                                              LP 617311
                                                              LP 687600
                                                              LP 757030
                                                              LP 829679
                                                              LP 900731
                                                              LP 971170
                                                              LP 1050418
                                                              LP 1129573
                                                              LP 1211527
                                                              LP 1302711
                                                              LP 1392592
                                                              LP 1484952
                                                              LP 1588415
                                                              LP 1671933
                                                              LP 1774071
                                                              LP 1863455
                                                              LP 1948307
                                                              LP 2062540
                                                              LP 2063826
                                                              LI _level0.Main_mc

                                                              • 29. Re: Nested clips for cacheAsBitmap using onLoadInit
                                                                kglad Adobe Community Professional & MVP

                                                                you're not loading the swf you think you're loading.

                                                                • 30. Re: Nested clips for cacheAsBitmap using onLoadInit
                                                                  Flanders_ZA-IgqhAi Level 1

                                                                  I've copied the two files to their own folder for testing. When tested from there, I get the results posted above as before and if I delete the main.swf in this folder then I get the error opening file msg so it's definitely trying to access the correct file. Checking it as thoroughly as possible now - was quite late here last night when I posted.

                                                                  • 31. Re: Nested clips for cacheAsBitmap using onLoadInit
                                                                    Flanders_ZA-IgqhAi Level 1

                                                                    Hi kglad, sorry it was just a simple goto missing from the onLoadInit. Here's the output from start:

                                                                     

                                                                    _level0
                                                                    load  main.swf _level0.Main_mc
                                                                    LS
                                                                    LP 85095
                                                                    LP 170759
                                                                    LP 270166
                                                                    LP 339940
                                                                    LP 407914
                                                                    LP 475258
                                                                    LP 544461
                                                                    LP 616811
                                                                    LP 687256
                                                                    LP 756571
                                                                    LP 829471
                                                                    LP 900492
                                                                    LP 970760
                                                                    LP 1050087
                                                                    LP 1129248
                                                                    LP 1210656
                                                                    LP 1302375
                                                                    LP 1392251
                                                                    LP 1484586
                                                                    LP 1588050
                                                                    LP 1671565
                                                                    LP 1773705
                                                                    LP 1863090
                                                                    LP 1947955
                                                                    LP 2061193
                                                                    LP 2063946
                                                                    LI _level0.Main_mc
                                                                    loaded swf
                                                                    onLoadInit: [type Function]
                                                                    showtarget: [type Function]
                                                                    onLoadComplete: [type Function]
                                                                    onLoadProgress: [type Function]
                                                                    onLoadStart: [type Function]
                                                                    contactClip: _level0.Main_mc.contactClip
                                                                    ContactBG: _level0.Main_mc.ContactBG
                                                                    DesignClip: _level0.Main_mc.DesignClip
                                                                    ConstructionClip: _level0.Main_mc.ConstructionClip
                                                                    ProjManClip: _level0.Main_mc.ProjManClip
                                                                    PropDevClip: _level0.Main_mc.PropDevClip
                                                                    contactBut: _level0.Main_mc.contactBut
                                                                    TopNav: _level0.Main_mc.TopNav
                                                                    footer: _level0.Main_mc.footer
                                                                    footer_L: _level0.Main_mc.footer_L
                                                                    footer_R: _level0.Main_mc.footer_R
                                                                    header_L: _level0.Main_mc.header_L
                                                                    header_R: _level0.Main_mc.header_R
                                                                    instance13: _level0.Main_mc.instance13
                                                                    footer_mask: _level0.Main_mc.footer_mask
                                                                    safeZone: _level0.Main_mc.safeZone
                                                                    navMenu: _level0.Main_mc.navMenu
                                                                    rollMask4: _level0.Main_mc.rollMask4
                                                                    rollMask2: _level0.Main_mc.rollMask2
                                                                    rollMask3: _level0.Main_mc.rollMask3
                                                                    rollMask1: _level0.Main_mc.rollMask1
                                                                    roll4: _level0.Main_mc.roll4
                                                                    roll3: _level0.Main_mc.roll3
                                                                    roll2: _level0.Main_mc.roll2
                                                                    roll1: _level0.Main_mc.roll1
                                                                    BackGround: _level0.Main_mc.BackGround
                                                                    contact_mask: _level0.Main_mc.contact_mask
                                                                    _level0.Main_mc.roll1
                                                                    loaded swf

                                                                    • 32. Re: Nested clips for cacheAsBitmap using onLoadInit
                                                                      kglad Adobe Community Professional & MVP

                                                                      what do you mean it was just a simple goto?

                                                                       

                                                                      jeez, show the code you're really using.  when you post code that's not what you're really using, you're misleading me.

                                                                      • 33. Re: Nested clips for cacheAsBitmap using onLoadInit
                                                                        Flanders_ZA-IgqhAi Level 1

                                                                        Apologies, kglad. Like I said, it was late and the original onLoadInit had this additional line of code as bolded...

                                                                         

                                                                        function onLoadInit(target){
                                                                        trace("LI "+target)
                                                                        for(var s:String in target){
                                                                        trace(s+": "+target[s]);
                                                                        }
                                                                        target.rollMask1.cacheAsBitmap = true;
                                                                        target.roll1.cacheAsBitmap = true;
                                                                        target.roll1.setMask("rollMask1");
                                                                        gotoAndStop(2);
                                                                        }

                                                                         

                                                                        ...which I missed because I copied your code from post no.19. So it was a matter of the start clip not going to frame 2 (something that became obvious once I'd had some sleep).

                                                                        • 34. Re: Nested clips for cacheAsBitmap using onLoadInit
                                                                          kglad Adobe Community Professional & MVP

                                                                          use:

                                                                           


                                                                          function onLoadInit(target){

                                                                          gotoAndStop(2); 


                                                                          trace("LI "+target)
                                                                          for(var s:String in target){
                                                                          trace(s+": "+target[s]);
                                                                          }
                                                                          target.rollMask1.cacheAsBitmap = true;
                                                                          target.roll1.cacheAsBitmap = true;
                                                                          target.roll1.setMask("rollMask1");

                                                                          }

                                                                           

                                                                          • 35. Re: Nested clips for cacheAsBitmap using onLoadInit
                                                                            Flanders_ZA

                                                                            _level0


                                                                            load  main.swf _level0.Main_mc
                                                                            LS
                                                                            LP 85095
                                                                            LP 170759
                                                                            LP 270166
                                                                            LP 339940
                                                                            LP 407914
                                                                            LP 475258
                                                                            LP 544461
                                                                            LP 616811
                                                                            LP 687256
                                                                            LP 756571
                                                                            LP 829471
                                                                            LP 900492
                                                                            LP 970760
                                                                            LP 1050087
                                                                            LP 1129248
                                                                            LP 1210656
                                                                            LP 1302375
                                                                            LP 1392251
                                                                            LP 1484586
                                                                            LP 1588050
                                                                            LP 1671565
                                                                            LP 1773705
                                                                            LP 1863090
                                                                            LP 1947955
                                                                            LP 2061193
                                                                            LP 2063946
                                                                            LI _level0.Main_mc
                                                                            loaded swf
                                                                            onLoadInit: [type Function]
                                                                            showtarget: [type Function]
                                                                            onLoadComplete: [type Function]
                                                                            onLoadProgress: [type Function]
                                                                            onLoadStart: [type Function]
                                                                            contactClip: _level0.Main_mc.contactClip
                                                                            ContactBG: _level0.Main_mc.ContactBG
                                                                            DesignClip: _level0.Main_mc.DesignClip
                                                                            ConstructionClip: _level0.Main_mc.ConstructionClip
                                                                            ProjManClip: _level0.Main_mc.ProjManClip
                                                                            PropDevClip: _level0.Main_mc.PropDevClip
                                                                            contactBut: _level0.Main_mc.contactBut
                                                                            TopNav: _level0.Main_mc.TopNav
                                                                            footer: _level0.Main_mc.footer
                                                                            footer_L: _level0.Main_mc.footer_L
                                                                            footer_R: _level0.Main_mc.footer_R
                                                                            header_L: _level0.Main_mc.header_L
                                                                            header_R: _level0.Main_mc.header_R
                                                                            instance13: _level0.Main_mc.instance13
                                                                            footer_mask: _level0.Main_mc.footer_mask
                                                                            safeZone: _level0.Main_mc.safeZone
                                                                            navMenu: _level0.Main_mc.navMenu
                                                                            rollMask4: _level0.Main_mc.rollMask4
                                                                            rollMask2: _level0.Main_mc.rollMask2
                                                                            rollMask3: _level0.Main_mc.rollMask3
                                                                            rollMask1: _level0.Main_mc.rollMask1
                                                                            roll4: _level0.Main_mc.roll4
                                                                            roll3: _level0.Main_mc.roll3
                                                                            roll2: _level0.Main_mc.roll2
                                                                            roll1: _level0.Main_mc.roll1
                                                                            BackGround: _level0.Main_mc.BackGround
                                                                            contact_mask: _level0.Main_mc.contact_mask
                                                                            _level0.Main_mc.roll1
                                                                            loaded swf
                                                                            • 36. Re: Nested clips for cacheAsBitmap using onLoadInit
                                                                              kglad Adobe Community Professional & MVP

                                                                              that can't be right.

                                                                               

                                                                              is gotoAndStop(2) really target.gotoAndStop(2)?

                                                                              • 37. Re: Nested clips for cacheAsBitmap using onLoadInit
                                                                                Flanders_ZA Level 1

                                                                                No, it's frame 2 of start. Preloader animates out and the header graphic animates in. The target clip only has one frame.

                                                                                • 38. Re: Nested clips for cacheAsBitmap using onLoadInit
                                                                                  kglad Adobe Community Professional & MVP

                                                                                  why is that goto needed to get the trace() output from main.swf?

                                                                                  • 39. Re: Nested clips for cacheAsBitmap using onLoadInit
                                                                                    Flanders_ZA Level 1

                                                                                    Start is basically an introduction of elements and a preloader for the larger main file. Because of timing requirements for different elements, there's:

                                                                                     

                                                                                    function onLoadProgress(target, loadedBytes, totalBytes){
                                                                                    trace("LP "+loadedBytes);
                                                                                    target.stop();
                                                                                        target._visible = false;
                                                                                        var StepUpBytes = totalBytes/100;
                                                                                        stepFrame = Math.floor(loadedBytes/StepUpBytes);
                                                                                        if(stepFrame<1){
                                                                                        stepFrame = 1;
                                                                                        }
                                                                                        preloader_mc.gotoAndStop(stepFrame+1); 
                                                                                    }

                                                                                     

                                                                                    On the load init, the start clip goes to frame 2 where another mc plays. At the end of that animation is:

                                                                                     

                                                                                    _root.Main_mc.play();

                                                                                     

                                                                                    So main loads on frame 1 of start and then plays on frame 2 of start, but only after the animation is complete. (the blank clip for main runs across frame 1 and 2 in start). If I comment out the target.stop(); in onLoadProgress then it doesn't need the goto to get the trace output but that causes havoc with timing of events.

                                                                                    1 2 Previous Next