3 Replies Latest reply on Apr 19, 2006 5:52 PM by Newsgroup_User

    how to get fps of a movie clip?

    bhu vidya
      a bit of a newbie question

      how do i find the fps of a movie clip in actionscript?

      cheers
      bhu
        • 1. Re: how to get fps of a movie clip?
          Level 7
          If you mean an external FLV movie? .. then use the metadata.

          If you mean an external SWF you loaded? .. you can't. And it is ignored
          when you load it in anyway.

          If you mean a movie clip already in the movie .. it will be the same as the
          whole movie .. and you cannot find the nominal FPS of a movie.

          You can calculate the actual fps be simply using an onEnterFrame and
          getTimer to see how long it takes to execute each frame.

          Question: Why do you even need to know?
          --
          Jeckyl


          • 2. Re: how to get fps of a movie clip?
            kglad Adobe Community Professional & MVP
            jeckyl, i have a question for you: if you define a named (as opposed to an anonymous) function within an if-statement (or another function block), it will not be defined even though that conditional executes. for example, the code below results in nothing in the output panel.

            i think this is because named functions are compiled before other script in the same location. conditional statements are skipped during this first pass looking for named functions. when the compiler makes a second pass and compiles the remaining code and hits a named function, it skips past that named function because it's no longer dealing with named functions. true?
            • 3. Re: how to get fps of a movie clip?
              Level 7
              Yeup .. Flash ignores named functions if they are inside a { } block. Even
              this fails...

              {
              function traceF() {
              trace("Defined");
              }
              }

              I _think_ that ECMA/JavaScript says this should work. I'm not sure though
              ... if so, then this is a bug.

              Your explanation of why it happens is correct .. the script compiler does a
              first pass for named functions and compiles them (obviously not looking
              inside and {} blocks), then it compiles everything EXCEPT for named
              functions (whether or not they are in {} blocks).
              --
              Jeckyl