# AS3: Sussing out Display Object name from Stage

**URL:** <https://forum.kirupa.com/t/as3-sussing-out-display-object-name-from-stage/289096>\
**Category:** flash\
**Created:** [May 26, 2009, 10:49am UTC](https://forum.kirupa.com/t/as3-sussing-out-display-object-name-from-stage/289096 "2009-05-26T10:49:46Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![gopaldass](https://avatars.discourse-cdn.com/v4/letter/g/c77e96/32.png) [@gopaldass](https://forum.kirupa.com/u/gopaldass)\
**Post date:** [May 26, 2009, 10:49am UTC](https://forum.kirupa.com/t/as3-sussing-out-display-object-name-from-stage/289096/1 "2009-05-26T10:49:46Z")

</div>

Hello,

I am not sure how to frame this question, so I have defined the logic below. Will be grateful for assistance. Am quite confused at the moment.

- I have created a custom class (BOX) with a MouseOver event function
- Then I created a MovieClip in the main stage(A blue rectangle) and associated it with this custom class
- I added five instances of this MovieClip on stage using the addChild. Therefore there are 5 blue rectangles on stage when the movie runs.

Question:

1. From the timeline of the main flash movie, how do I detect the instance name over which the mouse is over?

The reason I want to do that is because I want to add 5 child sprites inside the instance the mouse is over.

Current Logic:

1. In the custom class - when mouse is over, I pass the the name to the main stage via a static public variable = CurrentInstanceName = this.name;
2. But when I try and use this - BOX. CurrentInstanceName.addChild();
3. It says Implicit Coercion of a value with static type Object.
4. However, when I manually put the instance name say: boxOne.addChild… it works. But the problem is I need to know which instance of BOX the mouse is over.

Any ideas folks? Or should I just put all the code within the BOX class where it draws 5 sprites on mouse over?

Many thanks!
