# Function in class subclassing Sprite

**URL:** <https://forum.kirupa.com/t/function-in-class-subclassing-sprite/308042>\
**Category:** flash\
**Created:** [April 15, 2010, 8:44pm UTC](https://forum.kirupa.com/t/function-in-class-subclassing-sprite/308042 "2010-04-15T20:44:19Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![dpdragnev](https://avatars.discourse-cdn.com/v4/letter/d/9f8e36/32.png) [@dpdragnev](https://forum.kirupa.com/u/dpdragnev)\
**Post date:** [April 15, 2010, 8:44pm UTC](https://forum.kirupa.com/t/function-in-class-subclassing-sprite/308042/1 "2010-04-15T20:44:19Z")

</div>

Hi All,

I have a class which subclasses Sprite (Class1). In this class I draw something on the stage. I have another class (Class2) that creates several instances of the first class (Class1) and places them on the stage. As I am creating the instances of Class1, I am adding an event listener for the CLICK event for each instance.

When I click on any of the Class1 instances, I would like to execute a public function in Class1. However e.target is Sprite and I cannot conver it to type Class1.

How can I execute this function from Class2?

Thank you,

Daniel
