AS3 Random.Math playing different movie clips

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):


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!