7 Replies Latest reply: Jun 19, 2012 1:21 PM by Ned Murphy RSS

    Preloader for multiple scenes

    dchero Community Member

      Hi, I'm trying to make a web site, I have 7 scenes and everything is working perfect. But here's my question.

      When I try to make 1st scene as a preloader nothing happens. Preloader never shows up and it jumps directly to 2nd scene "Main"

      Here's my code:

       

      stop();

       

       

      this.addEventListener(Event.ENTER_FRAME, loading);

       

       

      function loading(e:Event):void {

       

       

                var total:Number = this.stage.loaderInfo.bytesTotal;

                var loaded:Number = this.stage.loaderInfo.bytesLoaded;

       

       

                bar_mc.scaleX = loaded/total;

                loader_txt.text = Math.floor((loaded/total)*100)+ "%";

       

       

                if (total == loaded) {

                          gotoAndPlay(1,"Main");

                          this.removeEventListener(Event.ENTER_FRAME, loading);

                }

       

       

      }

       

      Also if I delete my contents in the "Main" scene and leave a single image, code works perfect.

      Preloader shows up and then loads my "Main" scene.

      How can I code it, as it first calculates my whole scenes, and shows my 1st scene "preloader" at the beginning.