# Can't cast event.target

**URL:** https://forum.kirupa.com/t/cant-cast-event-target/240194
**Category:** flash
**Created:** [September 30, 2007, 6:38pm UTC](https://forum.kirupa.com/t/cant-cast-event-target/240194 "2007-09-30T18:38:06Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![Element9](https://avatars.discourse-cdn.com/v4/letter/e/5f9b8f/32.png) [@Element9](https://forum.kirupa.com/u/Element9)
#### Post date: [September 30, 2007, 6:38pm UTC](https://forum.kirupa.com/t/cant-cast-event-target/240194/1 "2007-09-30T18:38:06Z")

</div>

I’m writing a gallery and I have writen custom Tumbnail class that extends Sprite. Each tumbnail has an ID property so I can determine which one is clicked.

I’ve added event listeners to all of them and in handler function tried:

```auto
var target:Tumbnail = Tumbnail(event.targer);

```

so I can get:

```auto
target.ID

```

but I get this error:

```auto
TypeError: Error #1034: Type Coercion failed: cannot convert flash.display::Sprite@33ce241 to Tumbnail.
	at TumbContainer/::onClick()

```

Anyone know what am I doing wrong?
