# Stopping or starting a movie clip at a random frame

**URL:** <https://forum.kirupa.com/t/stopping-or-starting-a-movie-clip-at-a-random-frame/186625>\
**Category:** Uncategorized\
**Created:** [April 22, 2006, 11:24pm UTC](https://forum.kirupa.com/t/stopping-or-starting-a-movie-clip-at-a-random-frame/186625 "2006-04-22T23:24:01Z")\
**Posts on this page:** 3\
**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 22, 2006, 11:24pm UTC](https://forum.kirupa.com/t/stopping-or-starting-a-movie-clip-at-a-random-frame/186625/1 "2006-04-22T23:24:01Z")

</div>

hi,  
i am loading random movie clips into 4 seperate empty movies, i now need a way to get these random clips that i am loading to play for a random amount of time and then load the next clip.

if i assign it a random number and get the clip to loop, then compare the number to the current frame of the movieclip and if true, tell it to stop and move to the next random clip…would this work?

i have no idea how to write the code for this  
any help would be great

thanks

---

<div class="post-metadata">

**Author:** ![B\_L\_U\_E](https://avatars.discourse-cdn.com/v4/letter/b/ba8739/32.png) [@B\_L\_U\_E](https://forum.kirupa.com/u/B_L_U_E)\
**Post date:** [April 23, 2006, 12:49am UTC](https://forum.kirupa.com/t/stopping-or-starting-a-movie-clip-at-a-random-frame/186625/2 "2006-04-23T00:49:23Z")

</div>

[COLOR=black][COLOR=#000000]After loading, do [AS]var rnd = Math.round(Math.random(mc.\_totalframes));  
mc.onEnterFrame = function() {  
this.\_currentframe \>= this.\_parent.rnd ? unloadMovie(this) : null;  
}[/AS]  
[/COLOR][/COLOR]

---

<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, 12:58am UTC](https://forum.kirupa.com/t/stopping-or-starting-a-movie-clip-at-a-random-frame/186625/3 "2006-04-23T00:58:10Z")

</div>

where do i put this?  
the timeline, emptymovieclip holders, or in each individual clip loaded?
