4 Replies Latest reply on Feb 23, 2011 8:12 AM by aandjmom

    Swapdepths  with new mc from dynamic text still not working.

    aandjmom Level 1

      Hello all

       

      Maybe this makes a difference but Im using Flas cs5 with AS2.  but my clock timer is still behind.  Ned, I  used your suggestion of putting my dynamic text into a new mc (  create sybol method, the only one I know)  then I made a new movieclilp named time_mc.  I then pasted the actionscript with the  30 minute countdown timer on it.  It is still behind.  The clouds have to stay  on the last depth and the timer has to stay on the top.  The rest can go whereever.  Not sure what i am doing wrong.  I bet Im doing something incorrect but cant figure it out.  I kept playing around with codes, but nothing worked.  Here is the final non-working code.  Please help.  Working on this issue three days.  The timer works if I remove all other layers but it stays hidden once I put them back,

       

      var totalTime = 1800;

       

      //Start from 30 minute

      var startTime = getTimer();

       

      this.onEnterFrame = function(){

      time_mc_1 = animator.attachMovie ('time_mc', 15);

       

      time_mc.swapDepths(_root.getNextHighestDepth);

       

          var timeLeft = (totalTime*1000)-(getTimer()-startTime);

          var seconds = Math.floor(timeLeft/1000);

          var minutes = 0;

       

          while (seconds>59) {

              seconds = seconds-60;

              minutes = minutes+1;

          }

       

          if (minutes<10) {

              minutes = String("0"+minutes);

          }

       

          if (seconds<10) {

              seconds = String("0"+seconds);

          }

       

          time_text.text = minutes+" : "+seconds;

       

          if (timeLeft<=0) {

              delete this.onEnterFrame;

              time_text.text = ("00:00");

              _root.gotoAndPlay(11);

          }

      }

        • 1. Re: Swapdepths  with new mc from dynamic text still not working.
          kglad Adobe Community Professional & MVP

          if time_mc is appearing below time_mc_1, it's because one of animator's  parent is above one of time_mc's parent (if there's nothing else  relevent to their depths in your swf).    check using:


           

           

          var totalTime = 1800;

           

          //Start from 30 minute

          var startTime = getTimer();

           

           

          traceF(animator):

          trace("***");

          traceF(time_mc_1);

           

          function traceF(mc:MovieClip){

          trace(mc+" "+mc.getDepth());

          while(mc._parent!=undefined){

          traceF(mc._parent);

          }

          }

           

           

          this.onEnterFrame = function(){

          time_mc_1 = animator.attachMovie ('time_mc', 15);

           

          time_mc.swapDepths(_root.getNextHighestDepth);

           

              var timeLeft = (totalTime*1000)-(getTimer()-startTime);

              var seconds = Math.floor(timeLeft/1000);

              var minutes = 0;

           

              while (seconds>59) {

                  seconds = seconds-60;

                  minutes = minutes+1;

              }

           

              if (minutes<10) {

                  minutes = String("0"+minutes);

              }

           

              if (seconds<10) {

                  seconds = String("0"+seconds);

              }

           

              time_text.text = minutes+" : "+seconds;

           

              if (timeLeft<=0) {

                  delete this.onEnterFrame;

                  time_text.text = ("00:00");

                  _root.gotoAndPlay(11);

              }

          }

          • 2. Re: Swapdepths  with new mc from dynamic text still not working.
            aandjmom Level 1

            Thanks  but It didn’t work, It gave me an syntax error on line 7  then my

            flash froze.

            • 4. Re: Swapdepths  with new mc from dynamic text still not working.
              aandjmom Level 1

              Still error message,

               

              But  I won't keep bugging you,    Chances are I'm not experienced enough.  I even tried to make the clouds using a tween,   and Guess what?  It worked perfectly.  Of course then my clock timer kept repeating itself at the same time I used to make my clouds loop  instead of going the full 30 min.  ( i used about 600 frames to get the cloud speed i wanted)

               

              I thought the clouds would simply loop for the entire 30 minutes but I guess once again, im missing something.

               

              The Good news is,

               

              I now know how to make a seamless backgroud loop and I now how to make a long clock timer,

               

              I just can't get them to work together.

               

              Thanks for both of you for helping a total noob.

               

              I'll get it someday.