• Keep in touch:
  • Linked In
  • Twitter
  • RSS

How many frames are in a movie?

Counting the number of frames in a movie is probably the simplest possible example of parsing a Flash file to extract information.

int count = 0;
for (MovieTag object : list) {
    if (object instanceof ShowFrame) {
        count++;
    }
}

Normally this is performed automatically by Movie and DefineMovieClip objects when they are encoded so the only practical use would be if you were writing your own version of Movie. This snippet does illustrate the basic technique for extracting information from a Flash file. More interesting information can be extract by simply extending this loop to include other classes as the other examples in this section will demonstrate.