MovieClip._totalframes Property | Flash 4 |
the total number of frames in a clip or movie timeline | read-only |
The integer _totalframes property represents the number of frames in mc's timeline, where mc is a movie clip or main movie. The _totalframes property is most often used along with _framesloaded to create preloaders, as shown in the entry for MovieClip._framesloaded.
The loadMovie( ) and unloadMovie( ) functions are executed asynchronously. Hence, the value of _framesloaded varies according to when it is called and the value of mc, as follows:
If mc is undefined, _totalframes is undefined.
After a loadMovie( ) or unloadMovie( ) statement occurs in source code, but before it executes, and before the number of frames of the external file has been determined, _totalframes returns the existing number of frames in mc (prior to the loadMovie( ) or unloadMovie( ) statement).
After the number of frames is determined, _totalframes returns the number of frames in the loading movie, unless the file at url is not found.
If the file at url is not found and mc is a movie clip, _totalframes returns 0 and _framesloaded returns -1. However, if mc is a document level, such as _level0, both _framesloaded and _totalframes return undefined.
After an unloadMovie( ) command executes, _totalframes returns 0 if mc is a movie clip and undefined if mc is a document level, such as _level0.