11 Replies Latest reply on Apr 30, 2011 6:19 AM by Ned Murphy

    pre loader?

    b_creative

      hi I'm using flash 8 also new in flash,I make a simple web site but I need to add loader

      so I follow a tutorial using AS3 but it give me error line 3 e:Event CZ I use AS2 so how to change the code?

       

      stop();
      addEventListener(Event.ENTER_FRAME, loaderF);
      function loaderF(e:Event):Void{
      var toLaod:Number = loaderInfo.bytesTotal;
      var loaded:Number = loaderInfo.bytesLoaded;
      var total:Number = loaded/toLoad;
      if(loaded == toLoad){
        removeEventLister(Event.ENTER_FRAME, loaderF);
        gotoAndStop(2);
      }else{
        preloader_mc.preloaderFill_mc.scaleX = total;
        preloader_mc.percent_txt.text = Math.floor(total*100) + "%";
        preloader_mc.ofBytes_txt.text = loaded + "bytes";
        preloader_mc.totalBytes_txt.text = toLaod + "bytes";
      }
      }

      there is the tutorial link

      http://www.tutvid.com/tutorials/flash/tutorials/as3Preloader.php

      this is my web I make using flash 8  (tell me what u think)

      www.moonshadow-flowers.com

      }

        • 1. Re: pre loader?
          kglad Adobe Community Professional & MVP

          stop();

          this.onEnterFrame=loaderF;
          function loaderF(e:Event):Void{
          var toLaod:Number = this.getBytesTotal();
          var loaded:Number = this.getBytesLoaded();
          var total:Number = loaded/toLoad;
          if(loaded == toLoad){
          delete this.onEnterFrame;
            gotoAndStop(2);
          }else{
            preloader_mc.preloaderFill_mc._xscale = total;
            preloader_mc.percent_txt.text = Math.floor(total*100) + "%";
            preloader_mc.ofBytes_txt.text = loaded + "bytes";
            preloader_mc.totalBytes_txt.text = toLaod + "bytes";
          }
          }


          • 2. Error
            b_creative Level 1

            **Error** Scene=Scene 1, layer=AS, frame=1:Line 4: The class or interface 'Event' could not be loaded.
                 function loaderF(e:Event):Void{

            Total ActionScript Errors: 1   Reported Errors: 1

            • 3. Re: pre loader?
              kglad Adobe Community Professional & MVP

              remove that:

               



              stop();

              this.onEnterFrame=loaderF;
              function loaderF():Void{
              var toLaod:Number = this.getBytesTotal();
              var loaded:Number = this.getBytesLoaded();
              var total:Number = loaded/toLoad;
              if(loaded == toLoad){
              delete this.onEnterFrame;
                gotoAndStop(2);
              }else{
                preloader_mc.preloaderFill_mc._xscale = total;
                preloader_mc.percent_txt.text = Math.floor(total*100) + "%";
                preloader_mc.ofBytes_txt.text = loaded + "bytes";
                preloader_mc.totalBytes_txt.text = toLaod + "bytes";
              }
              }


              • 4. Re: pre loader?
                b_creative Level 1

                no error but,

                preloader_mc.preloaderFill_mc._xscale = total;  (dosent work didnt fill)
                  preloader_mc.percent_txt.text = Math.floor(total*100) + "%"; (in run the text is NaN %)

                • 5. Re: pre loader?
                  kglad Adobe Community Professional & MVP

                  you have, at least, one typo:  toLaod should be toLoad

                   

                   




                  stop();

                  this.onEnterFrame=loaderF;
                  function loaderF():Void{
                  var toLoad:Number = this.getBytesTotal();
                  var loaded:Number = this.getBytesLoaded();
                  var total:Number = loaded/toLoad;
                  if(loaded == toLoad){
                  delete this.onEnterFrame;
                    gotoAndStop(2);
                  }else{
                    preloader_mc.preloaderFill_mc._xscale = total;
                    preloader_mc.percent_txt.text = Math.floor(total*100) + "%";
                    preloader_mc.ofBytes_txt.text = loaded + "bytes";
                    preloader_mc.totalBytes_txt.text = toLaod + "bytes";
                  }
                  }


                  • 6. Re: pre loader?
                    b_creative Level 1

                    still something wrong

                    check this

                    www.moonshadow-flowers.com

                     

                    that the result i get

                    • 7. Re: pre loader?
                      kglad Adobe Community Professional & MVP

                      you have a typo:  toLaod should be toLoad

                      • 8. Re: pre loader?
                        b_creative Level 1

                        i check it twice no typo?????

                        • 9. Re: pre loader?
                          relaxatraja Level 5

                          stop();

                           

                          this.onEnterFrame=loaderF;
                          function loaderF():Void{
                          var toLoad:Number = this.getBytesTotal();
                          var loaded:Number = this.getBytesLoaded();
                          var total:Number = loaded/toLoad;
                          if(loaded == toLoad){
                             preloader_mc._visible=false;
                            delete this.onEnterFrame;
                            gotoAndStop(2);
                          }else{
                            preloader_mc.preloaderFill_mc._xscale = Math.floor(total*100);
                            preloader_mc.percent_txt.text = Math.floor(total*100) + "%";
                           
                            preloader_mc.ofBytes_txt.text = loaded + "bytes";
                            preloader_mc.totalBytes_txt.text = toLaod + "bytes";
                          }
                          }

                          • 10. Re: pre loader?
                            kglad Adobe Community Professional & MVP

                            and?

                            • 11. Re: pre loader?
                              Ned Murphy Adobe Community Professional & MVP

                              (heh... it's been contagious for a day or three now)