# Retrieving name of a TimerEvent

**URL:** <https://forum.kirupa.com/t/retrieving-name-of-a-timerevent/282866>\
**Category:** flash\
**Created:** [February 27, 2009, 9:18am UTC](https://forum.kirupa.com/t/retrieving-name-of-a-timerevent/282866 "2009-02-27T09:18:03Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![way2web](https://avatars.discourse-cdn.com/v4/letter/w/f08c70/32.png) [@way2web](https://forum.kirupa.com/u/way2web)\
**Post date:** [February 27, 2009, 9:18am UTC](https://forum.kirupa.com/t/retrieving-name-of-a-timerevent/282866/1 "2009-02-27T09:18:03Z")

</div>

Hi,

I’m using multiple timers in a script, but I would like to use the same function with a Switch to define the appropriate action corresponding to the event.target. I’ve tried e.target.name but it says that name isn’t a property of the Timer class…  
Any Idea how can I retrieve the names (timer or timer2) within the onTimer function?

Thanks in advance!

```auto
var timer:Timer = new Timer(3000);
var timer2:Timer = new Timer(3500);

timer.addEventListener(TimerEvent.TIMER, onTimer);
timer2.addEventListener(TimerEvent.TIMER, onTimer);
timer.start();
timer2.start();

var lilStar_mc:LilStar = new LilStar();
var lilStar2_mc:LilStar = new LilStar();
//
function onTimer(e:TimerEvent):void
{
    trace(e.target);
    lilStar_mc.x= Math.round(Math.random() * stage.stageWidth);
    lilStar_mc.y = Math.round(Math.random() * stage.stageHeight);
    trace(lilStar_mc.x, lilStar_mc.y);
    addChild(lilStar_mc);
    lilStar_mc.gotoAndPlay(1);
}

```
