# Using getObjectsUnderPoint and getQualifiedClassName together

**URL:** <https://forum.kirupa.com/t/using-getobjectsunderpoint-and-getqualifiedclassname-together/228167>\
**Category:** flash\
**Created:** [June 5, 2007, 8:46pm UTC](https://forum.kirupa.com/t/using-getobjectsunderpoint-and-getqualifiedclassname-together/228167 "2007-06-05T20:46:27Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![costa](https://avatars.discourse-cdn.com/v4/letter/c/85f322/32.png) [@costa](https://forum.kirupa.com/u/costa)\
**Post date:** [June 5, 2007, 8:46pm UTC](https://forum.kirupa.com/t/using-getobjectsunderpoint-and-getqualifiedclassname-together/228167/1 "2007-06-05T20:46:27Z")

</div>

Dear all ,

I need again your help with this code.

What I am trying to do is to get the name of a movieClip in a specific point. According to next code I would expect to get the name “myMovie” using container.getChildByName(instance) but the problem is objectsBelowMouse[0].name gives my a different instance name. The container tells me that the name of the instance is “instance2” but container.getChildByName(instance) tells that the instance name is “instance3”. So when I try to get the name getQualifiedClassName (target) gives me a null. If I wrtite:

```auto
var target:DisplayObject = container.getChildByName("instance2")
trace(getQualifiedClassName (target));

```

I got the name “myMovie”, this is what I want

This the code:

```auto

var container:MovieClip = new MovieClip();
addChild(container);
render("myMovie",400,300);
stage.addEventListener(Event.ENTER_FRAME,mainLoop);
function mainLoop(event:Event) {
	var location:Point = new Point(stage.mouseX, stage.mouseY);
	var objectsBelowMouse:Array = container.getObjectsUnderPoint(location);
	if (objectsBelowMouse.length >0) {
		var instance:String = objectsBelowMouse[0].name
		var target:DisplayObject = container.getChildByName(instance)
		trace(instance);//instance3
		trace(getQualifiedClassName (target));//null
		trace(container.getChildAt(0).name)// instance2
	}
}

function render(nameClass:String,posX:Number,posY:Number):void {
	var classRef:Class = getDefinitionByName(nameClass) as Class;
	var instance:Object = new classRef();
	container.addChild(DisplayObject(instance));
	instance.x=posX;
	instance.y = posY;
}

```

I will appreciate your help.

Thanlks
