8 Replies Latest reply on Jul 29, 2016 2:37 PM by kglad

    Timer for "test movie"

    johnFlashStuffs Level 1

      Hi.  I did a search for this issue but I get a lot of hits on how to use flash to make a stopwatch/timer.  That's not what I want.

       

      I want to know if there's a way to put a timer on the "test movie" screen after pressing "ctrl+enter".  Ordinarily for a scene the timeline will say how many seconds it is, but with multiple scenes it'd be nice to have a timer right there on the screen rather than scrolling through each scene adding up the time.  Is there anything available like that, maybe through an actionscript?

       

      Thanks.

        • 1. Re: Timer for "test movie"
          kglad Adobe Community Professional & MVP

          you want users to be able to see how many seconds remaining until the main timeline reaches its last frame?

           

          if so, and assuming there are no stops on the main timeline,

           

          this.addEventListener(Event.ENTER_FRAME,f);

          function f(e:Event):void{

          whatever_tf.text=(this.totalFrames-this.currentFrame)/stage.frameRate+' seconds remaining';

          if(this.totalFrames==this.currentFrame){

          this.removeEventListener(Event.ENTER_FRAME,f);

          }

          }

          • 2. Re: Timer for "test movie"
            ClayUUID Adobe Community Professional

            I don't understand what testing the movie with a current time display has to do with calculating the total run time of all scenes. It almost sounds like you're asking for two different, unrelated things.

            • 3. Re: Timer for "test movie"
              johnFlashStuffs Level 1

              I want a timer (like a stopwatch), not a clock,  to appear when I hit "test movie" so that I can see how much time is elapsing as I watch the video run through it's various scenes.  Ideally I'd be able to turn it off before converting the swf to mp4 as there would be no point to it other than my own personal use so that I can know the total runtime of the scenes without needing to navigate to each individual scene. 

               

              Or, maybe I'm making it too complicated.  I want to know, at a glance, the total length, in seconds/minutes, of all the scenes combined without needing to manually add up the various run times of each scene. Is there a setting which details this information?

              • 4. Re: Timer for "test movie"
                johnFlashStuffs Level 1

                Hi kglad, I put the code snippet you suggested into the first frame of a layer on the main timeline. When testing the movie I get the error,  "1120: access of undefined property whatever_tf".

                • 5. Re: Timer for "test movie"
                  kglad Adobe Community Professional & MVP

                  if you wanted to display that in a textfield, you would use that code.

                   

                  but for your own purposes you can use:

                   

                  trace((this.totalFrames-this.currentFrame)/stage.frameRate+' seconds remaining');

                  • 6. Re: Timer for "test movie"
                    johnFlashStuffs Level 1

                    Hi Kglad.  Yes, that works.  Thanks for the code.

                    • 7. Re: Timer for "test movie"
                      ClayUUID Adobe Community Professional

                      johnFlashStuffs wrote:

                      Or, maybe I'm making it too complicated.

                      Very much so. Sitting and twiddling your thumbs while a timer counts up is hardly a superior solution. No, this is exactly the sort of thing that JSFL is for.

                       

                      Paste the following into a text file with a name of your choosing, save it, then change the extension to JSFL.

                       

                      // calculate total runtime of all scenes
                      var dom = fl.getDocumentDOM();
                      var frames = 0;
                      for (var i = 0; i < dom.timelines.length; i++) {
                          frames += dom.timelines[i].frameCount;
                      }
                      alert(frames + " frames at " + dom.frameRate + " FPS = " + frames / dom.frameRate + " seconds");
                      

                       

                      Double-click this file while your project is open in Animate. It will calculate and display the total runtime for all scenes.

                       

                      If you want to get extra fancy you can move the script into your Animate configuration folder, which will let it appear under the Commands menu.

                      • 8. Re: Timer for "test movie"
                        kglad Adobe Community Professional & MVP

                        you're welcome.