AS3 TweenLite/Mouseover/Math.Random Help!


import gs.TweenLite;
import gs.OverwriteManager;
import gs.easing.*;

stop();

OverwriteManager.init();
        
var clipArray:Array = new Array();
        
var numButtons:int = 31;
for (var k:int = 1; k < numButtons; k++)
{
    this["btn" + k].addEventListener(MouseEvent.CLICK, showClickedImage);
    //push each button into an array
    clipArray.push(this["btn"+k]);
}



function openRandomClip():void
{
    var randomClip:int = Math.random()*clipArray.length;
    showClickedImage(null, clipArray[randomClip]);
}


openRandomClip();


function showClickedImage(event:MouseEvent = null, targetClip:SimpleButton = null):void
{
var target:Object =  event!=null ? event.target : targetClip;
        //cary on as normal
        this.setChildIndex(this.getChildByName(target.name), this.numChildren-1);
        var orgWidth:int = target.width;
        var orgHeight:int = target.height;
        var orgX:int = target.x
        var orgY:int = target.y
        TweenLite.to(target, 1, {width:350, height:350, x:25, y:0, ease:Bounce.easeOut, delay: 1})
        TweenLite.to(target, 1, {width:orgWidth, height:orgHeight, x:orgX, y:orgY, ease:Bounce.easeOut, delay:4})
}

This is my code that make myimage thumbnails tween to maximized stage size than tween back again a few seconds after. I’m wondering if someone could help me make the openRandomClip function get called again or loop somehow so that the images will continue to randomly maximize then shrink on their own. I used the onComplete arguement to do this at first, but then the dilemna exists where I want the user to be able to click on any of the thumbnails and have only that specific image maximize. I had that working, but it wouldn’t stop the openRandomClip when the user clicks, so two images would then start popping up, and everytime you click a thumbnail another randomimage routine would be added to the mix.

I basically just want to be able to make it so that when/if the user mouses over ANY thumbnail it will just pause the openRandomClip from happening and let the user look around and click certain ones if desired. Then once the user mouses out off the entire movie of just off all the thumbnails I want the randomclip to resume again.

Can anyone help me with that? I’m totally stuck on how to do it!! Thanks in advance!

-Matt :slight_smile: