AS3: Sussing out Display Object name from Stage

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!