# AS3 Random.Math playing different movie clips

**URL:** <https://forum.kirupa.com/t/as3-random-math-playing-different-movie-clips/315348>\
**Category:** flash\
**Created:** [October 23, 2010, 4:21pm UTC](https://forum.kirupa.com/t/as3-random-math-playing-different-movie-clips/315348 "2010-10-23T16:21:52Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![sb1984](https://avatars.discourse-cdn.com/v4/letter/s/73ab20/32.png) [@sb1984](https://forum.kirupa.com/u/sb1984)\
**Post date:** [October 23, 2010, 4:21pm UTC](https://forum.kirupa.com/t/as3-random-math-playing-different-movie-clips/315348/1 "2010-10-23T16:21:52Z")

</div>

Hi,

I just recently tried getting the hand of understanding AS3 from AS3. I am finding it a bit of a struggle to try and understand using random.math.

I am trying to use random.math to make each movieclip play randomly and then stop. I tried looking for online tutorials but I only seem to get information of creating a random math number which I don’t want.

I am not sure I am meant to use a timer or to use random.math function. The idea is to have say 4 movieclips start an animation randomly so when the user looks at the screen, a different movieclip will play.

Does this make any sense? Does anyone know if I am on the right direction or whether there are any good tutorials that can help?

For my button I have put this code for them (photo\_mc is my button):

```auto

import fl.transitions.*;  
import fl.transitions.easing.*;  
 
photo_mc.addEventListener(MouseEvent.MOUSE_OVER, doMouseOver);  
photo_mc.addEventListener(MouseEvent.MOUSE_OUT, doMouseOut);  

function doMouseOver(event:MouseEvent):void {  

var xT:Tween = new Tween(photo_mc, "scaleX", Bounce.easeOut, photo_mc.scaleX, 1.5, 1, true);  
var yT:Tween = new Tween(photo_mc, "scaleY", Bounce.easeOut, photo_mc.scaleY, 1.5, 1, true);  
}  

function doMouseOut(event:MouseEvent):void {  
var xT:Tween = new Tween(photo_mc, "scaleX", Bounce.easeOut, photo_mc.scaleX, 1, 2, true);  
var yT:Tween = new Tween(photo_mc, "scaleY", Bounce.easeOut, photo_mc.scaleY, 1, 2, true);  
}  

```

Any help will be greatly appreciated. I think using a mouseOver is probably the wrong way to do it as I want to script a random.math to play each movieclip in a different order each time.

Thanks!
