# TIMER problem

**URL:** <https://forum.kirupa.com/t/timer-problem/314064>\
**Category:** flash\
**Created:** [September 17, 2010, 8:19am UTC](https://forum.kirupa.com/t/timer-problem/314064 "2010-09-17T08:19:43Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![elliria](https://avatars.discourse-cdn.com/v4/letter/e/f04885/32.png) [@elliria](https://forum.kirupa.com/u/elliria)\
**Post date:** [September 17, 2010, 8:19am UTC](https://forum.kirupa.com/t/timer-problem/314064/1 "2010-09-17T08:19:43Z")

</div>

hi everyone, i’ve gone crazy with a timer problem:  
i have a series of elements put into an array and i simply want to create an html “ALT effect”. if you stay on it with the mouse for a while it shows some text.  
so i tried putting a timer using TIMER\_COMPLETE for triggering the function, and it works

```auto

[COLOR=Gray]//i add the empty label to the display list as invisible.[/COLOR]
var label1:testone = new testone();
label1.mouseChildren = false;
label1.visible = false;
addChild(label1);

var squares:Array= [square1,square2,square3];

var delay:Timer = new Timer(1000,1);

[COLOR=Gray]//i add the listener for mouseover and mouseout to the array elements[/COLOR]
for (var e:int = 0; e < squares.length; e++) {
        squares[e].addEventListener(MouseEvent.MOUSE_OVER,delayed);
        squares[e].addEventListener(MouseEvent.MOUSE_OUT,stopTimer);
        }
[COLOR=Gray]//i start the timer and call the timer complete in order to trigger the //function[/COLOR]
function delayed(event:MouseEvent) {
        delay.start();
        delay.addEventListener(TimerEvent.TIMER_COMPLETE,do_after_delay);
        
            function do_after_delay(event:Event) {
                    label1.visible = true;
                    label1.testo.text = "bauciau" //i need to declare String (event.currentTarget.name);
                    label1.x= 300;
                    label1.y= 30;
                    
                }
}
[COLOR=Gray]// i stop the timer and reset everything[/COLOR]
function stopTimer(event:MouseEvent){
        label1.visible=false;
        delay.stop();
        delay.reset();
}

```

**the problem is i need to assign a different text to every element and i have to address the event.currentTarget**.  
if i do, it doesn’t work anymore 'cause the timer\_complete event doesn’t have a currentTarget…
