# dropTarget.name is not resolving correctly

**URL:** <https://forum.kirupa.com/t/droptarget-name-is-not-resolving-correctly/313121>\
**Category:** flash\
**Created:** [August 20, 2010, 5:27pm UTC](https://forum.kirupa.com/t/droptarget-name-is-not-resolving-correctly/313121 "2010-08-20T17:27:41Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![jik\_ff](https://avatars.discourse-cdn.com/v4/letter/j/bc79bd/32.png) [@jik\_ff](https://forum.kirupa.com/u/jik_ff)\
**Post date:** [August 20, 2010, 5:27pm UTC](https://forum.kirupa.com/t/droptarget-name-is-not-resolving-correctly/313121/1 "2010-08-20T17:27:41Z")

</div>

I have 2 custom class objects (both MC). I want to check when objA is dragged onto the objB.  
Each class constructor defines it name value, so on creation in my document class, if I trace thier names they come out as objA and objB.  
In the code for objA, I manage the startDrag and stopDrag:

```auto
  function toDrag(e$:MouseEvent):void{
   this.startDrag(true);
   was = new Point(this.x, this.y);
   trace("Placing a "+this.name);
  }
  
  function toDrop(e$:MouseEvent):void{
   if(!this.dropTarget){
    dropFail(this);
   }
   trace(this.name+" Is dropping on "+this.dropTarget.name);
   dropFail(this);
  }
  function dropFail(obj:Sprite):void{
   obj.stopDrag();
   obj.x = was.x;
   obj.y = was.y;
   
  }

```

[EDIT]: Don’t worry about the dropFail(), as while testing, I want things to move back  
When I try this out, this.dropTraget.name comes out as Instance#, instead of objB. Why? I made a click check in objB:

```auto
  function NameMe($e:MouseEvent):void{
   trace("Clicked on "+this.name);
  }

```

This comes back with the right name, but the dropTarget call does not. Again, why?
