# How to get the total frames in a movie clip

**URL:** <https://forum.kirupa.com/t/how-to-get-the-total-frames-in-a-movie-clip/186710>\
**Category:** Uncategorized\
**Created:** [April 23, 2006, 10:14pm UTC](https://forum.kirupa.com/t/how-to-get-the-total-frames-in-a-movie-clip/186710 "2006-04-23T22:14:15Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![bltrio](https://avatars.discourse-cdn.com/v4/letter/b/e274bd/32.png) [@bltrio](https://forum.kirupa.com/u/bltrio)\
**Post date:** [April 23, 2006, 10:14pm UTC](https://forum.kirupa.com/t/how-to-get-the-total-frames-in-a-movie-clip/186710/1 "2006-04-23T22:14:15Z")

</div>

im loading random movieclips from an external folder into an emptymc,  
i need a way to get flash to tell me the number of frames in the random clip that has been loaded.

this is what i’m trying to use now to give me a random #, within the # of frames loaded

```auto
var rNum = Math.round(Math.random(emptymc1,_totalframes))

```

the clips im using have 90-100 frames, but the number im getting is either 1 or 0

does anyone have any idea what’s wrong?

---

<div class="post-metadata">

**Author:** ![TheCanadian](https://avatars.discourse-cdn.com/v4/letter/t/67e7ee/32.png) [@TheCanadian](https://forum.kirupa.com/u/TheCanadian)\
**Post date:** [April 24, 2006, 12:21am UTC](https://forum.kirupa.com/t/how-to-get-the-total-frames-in-a-movie-clip/186710/2 "2006-04-24T00:21:06Z")

</div>

```auto
var rNum = Math.ceil(Math.random() * emptymc1._totalframes);

```
