2 Replies Latest reply on Dec 18, 2011 4:15 PM by GX_Tidus

    External preloader question

    GX_Tidus

      Hello there i got a question and i would be gratefull if you could help me out.

      I've got an external preloader from this tutorial http://doogog.com/actionscript-3-external-preloader.html

      and i would like to merge it with an preloader from oxylusflash (its a premium preloader)

       

      heres the code from the preloader

       

      [code]

      // import eaze tween

      import aze.motion.EazeTween;

      import aze.motion.easing.Elastic;

       

      // change this to make it play or stop the parent of finish

      // after the loading is done the parent will play or stop to the next frame

      var onFinishPlayParent:Boolean = false;

       

      // set the position of the preloader

      var xPos:int = (stage.stageWidth - 48)/2;

      var yPos:int = (stage.stageHeight - 48)/2;

       

      // stop the loader's parent

      var parentMc:MovieClip = MovieClip(this.parent);

      parentMc.stop();

      // stop the loader

      stop();

       

      // set the position of the preloader

      this.x = xPos;

      this.y = yPos;

       

      var balls:Array = [ball1, ball2, ball3, ball4, ball5, ball6, ball7, ball8];

      var done:Array = [false, false, false, false, false, false, false, false];

       

      for (var i:int =0; i< balls.length; i++)

      {

          balls[i].visible = false;

          balls[i].scaleX = balls[i].scaleY = 0.15;

      }

       

      // start a 100ms timer

      var updateTimer:Timer = new Timer(100);

      updateTimer.addEventListener(TimerEvent.TIMER, update);

      updateTimer.start();

       

      // updates the preloader

      function update(e:Event)

      {

          var percentage:int;   

         

          percentage = Math.floor(stage.loaderInfo.bytesLoaded*100/stage.loaderInfo.bytesTotal);       

         

          display.text = String(percentage);

       

         

          if(percentage >12 && done[0] == false)

          {

              balls[0].visible = true;

              done[0] = true;

              new EazeTween(balls[0]).to(0.5,{scaleX:1, scaleY:1}).easing(Elastic.easeOut);

          }

          if(percentage >24 && done[1] == false)

          {

              balls[1].visible = true;       

              done[1] = true;

              new EazeTween(balls[1]).to(0.5,{scaleX:1, scaleY:1}).easing(Elastic.easeOut);

          }   

          if(percentage >36 && done[2] == false)

          {

              balls[2].visible = true;       

              done[2] = true;

              new EazeTween(balls[2]).to(0.5,{scaleX:1, scaleY:1}).easing(Elastic.easeOut);

          }       

          if(percentage >48 && done[3] == false)

          {

              balls[3].visible = true;       

              done[3] = true;

              new EazeTween(balls[3]).to(0.5,{scaleX:1, scaleY:1}).easing(Elastic.easeOut);

          }   

          if(percentage >60 && done[4] == false)

          {

              balls[4].visible = true;       

              done[4] = true;

              new EazeTween(balls[4]).to(0.5,{scaleX:1, scaleY:1}).easing(Elastic.easeOut);

          }       

          if(percentage >72 && done[5] == false)

          {

              balls[5].visible = true;       

              done[5] = true;

              new EazeTween(balls[5]).to(0.5,{scaleX:1, scaleY:1}).easing(Elastic.easeOut);

          }       

          if(percentage >84 && done[6] == false)

          {

              balls[6].visible = true;       

              done[6] = true;

              new EazeTween(balls[6]).to(0.5,{scaleX:1, scaleY:1}).easing(Elastic.easeOut);

          }       

          if(percentage >96 && done[7] == false)

          {

              balls[7].visible = true;       

              done[7] = true;

              new EazeTween(balls[7]).to(0.5,{scaleX:1, scaleY:1}).easing(Elastic.easeOut);

          }       

          if(percentage >= 100)

          {

              updateTimer.removeEventListener(TimerEvent.TIMER, update);

              updateTimer.stop();

              updateTimer = null;

             

              // play or stop on the next frame for the loade parent

              if(!onFinishPlayParent)

                  parentMc.gotoAndStop(parentMc.currentFrame+1);

              else   

                  parentMc.gotoAndPlay(parentMc.currentFrame+1);               

                 

              new EazeTween(this).to(1,{alpha:0})

          }       

      }

      [/code]