Flash MX 2004.
timeline.frameCount
Read-only property; an integer that represents the number of frames in this timeline’s longest layer.
The following example uses a countNum variable to store the number of frames in the current document’s longest layer:
var countNum = fl.getDocumentDOM().getTimeline().frameCount;