# Timer And Array - Call Tagret from outside function?

**URL:** <https://forum.kirupa.com/t/timer-and-array-call-tagret-from-outside-function/331085>\
**Category:** flash\
**Created:** [May 14, 2013, 3:07am UTC](https://forum.kirupa.com/t/timer-and-array-call-tagret-from-outside-function/331085 "2013-05-14T03:07:31Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![na\_il](https://avatars.discourse-cdn.com/v4/letter/n/bc79bd/32.png) [@na\_il](https://forum.kirupa.com/u/na_il)\
**Post date:** [May 14, 2013, 3:07am UTC](https://forum.kirupa.com/t/timer-and-array-call-tagret-from-outside-function/331085/1 "2013-05-14T03:07:31Z")

</div>

I have two arrays, and when the mouse is over the first array, I want the second array to scale “x” amount every 10 seconds. So to do this I set up a timer. So whenever the mouse is over the first array the timer starts… One problem! All of the second array scales at the same time! Since it is a timer event I can’t use “e.target” to specify what object in array to get, but if I can somehow get the e.target info from the mouse over event in first array I could save in string outside of function to get right name in second array because they are similarly named:

but here is part of code

```auto

var btnArray:Array = [btn1, btn2, btn3, btn4];
var scaleArray = [btn1Loader, btn2Loader, btn3Loader, btn4Loader];

for each (var c in btnArray)
{
    c.addEventListener(MouseEvent.ROLL_OVER, fadeIn);
    c.addEventListener(MouseEvent.ROLL_OUT, fadeOut);
    c.alpha = 1;
    
}

function fadeIn(e:MouseEvent):void
{
    TweenMax.to(e.target, 1, {alpha:0, repeat:-1, yoyo:true,ease:Linear.easeNone});

//HOW CAN I GET THIS INFO OUTSIDE FUNCTION???     
var currentLoader:String = e.target.name + "Loader" 

    myTimer.start();

}

function fadeOut(e:MouseEvent):void
{
    TweenMax.to(e.target, 1.5, {alpha:1});
    //c.removeEventListener(MouseEvent.MOUSE_OVER, startScale);
    myTimer.stop();
}

myTimer.addEventListener(TimerEvent.TIMER, nextOne)

function nextOne(e:TimerEvent):void{
    
    for each (var c in scaleArray){
        c.scaleX = 10
    }
}

```
