6 Replies Latest reply on May 20, 2009 8:11 AM by kglad

    before and after the preloader...

    esco1313

      Hello!

       

      so i have this preloader... but when it finishes, before it goes on and play Scene 2, i want it to play an animation. For sure, if i put the animation in my preloader time line, it will play WHILE loading, which isnt what i want. Basically, i'm looking to create a IN and OUT animation. What and where should i integrate that?

       

      Here is my code for the preloader:

       

      var amountLoaded:Number = _root.getBytesLoaded()/_root.getBytesTotal();
      preloader = amountLoaded*200;
      _root.loadText.text = Math.round(amountLoaded*100)+"%";
      _root.loadText2= Math.round(amountLoaded*100);
      _root.progressMc.gotoAndStop(loadText2);

       

      if(_root.getBytesLoaded() == _root.getBytesTotal())  {
           gotoAndPlay("Scene 2", 1);
      }

       

      else {
           gotoAndPlay(1);
      }

       

      Thanks

        • 1. Re: before and after the preloader...
          kglad Adobe Community Professional & MVP

          you can put it wherever you want.

           

          if you put it on the main timeline, then direct the main timeline to the first frame that you want to display after the preloader and on the last frame of that out animation direct the main timeline to scene2/frame1.

           

          p.s.  you shouldn't use the goto functions and you shouldn't use scene info for navigation in as2.  use the goto methods and frame labels:

           

          _root.gotoAndPlay("scene2_frame1");  // and label this frame

          • 2. Re: before and after the preloader...
            esco1313 Level 1

            should i do this?:

             

            var amountLoaded:Number = _root.getBytesLoaded()/_root.getBytesTotal();
            preloader = amountLoaded*200;
            _root.loadText.text = Math.round(amountLoaded*100)+"%";
            _root.loadText2= Math.round(amountLoaded*100);
            _root.progressMc.gotoAndStop(loadText2);

             

            if(_root.getBytesLoaded() == _root.getBytesTotal())  {
                 _root.gotoAndPlay("animOut");
            }

             

            else {
                 gotoAndPlay(1);
            }

             

            and at the end of animOut:

             

            _root.gotoAndPlay("scene2_frame1");

             

            ??

            • 3. Re: before and after the preloader...
              kglad Adobe Community Professional & MVP

              that looks good.  be sure to label the "animOut" frame and "scene2_frame1".

              • 4. Re: before and after the preloader...
                esco1313 Level 1

                nice thanks! i'm getting better and better HAHA

                • 5. Re: before and after the preloader...
                  esco1313 Level 1

                  but does that mean that my progress animation has to be 100 frames? because when its shorter, the animation finishes before the % reaches 100%, and it just stays there until it hits 100%...

                  • 6. Re: before and after the preloader...
                    kglad Adobe Community Professional & MVP

                    that's what your code does.  if you don't want your preloader to be 100 frames use:

                     


                     

                    var amountLoaded:Number = _root.getBytesLoaded()/_root.getBytesTotal();
                    preloader = amountLoaded*200;
                    _root.loadText.text = Math.round(amountLoaded*100)+"%";
                    _root.loadText2= Math.round(amountLoaded*100);
                    _root.progressMc.gotoAndStop(Math.ceil(amountLoaded*_root.progressMc._totalframes));

                     

                    if(_root.getBytesLoaded() == _root.getBytesTotal())  {
                         _root.gotoAndPlay("animOut");
                    }

                     

                    else {
                         gotoAndPlay(1);
                    }

                     

                    and at the end of animOut:

                     

                    _root.gotoAndPlay("scene2_frame1");

                     

                    ??