# Convert code from \_dropTarget to hitTest

**URL:** <https://forum.kirupa.com/t/convert-code-from--droptarget-to-hittest/317064>\
**Category:** flash\
**Created:** [December 9, 2010, 2:22pm UTC](https://forum.kirupa.com/t/convert-code-from--droptarget-to-hittest/317064 "2010-12-09T14:22:48Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![AndrewELB](https://avatars.discourse-cdn.com/v4/letter/a/c57346/32.png) [@AndrewELB](https://forum.kirupa.com/u/AndrewELB)\
**Post date:** [December 9, 2010, 2:22pm UTC](https://forum.kirupa.com/t/convert-code-from--droptarget-to-hittest/317064/1 "2010-12-09T14:22:48Z")

</div>

I’m trying to use a drag and drop activity in Adobe Presenter and discovered that \_dropTarget doesn’t seem to be supported. The post said to use hitTest instead. The problem is that I can’t figure out a way to easily tweak my code. Anyone see a way to quickly change to hitTest? (Thanks for your help!)

Here’s the code:

stop();  
finisher.\_visible = false;

var counter:Number = 0;

onEnterFrame = function():Void{  
if(counter == 4){  
finisher.\_visible = true;  
finisher.nextFrame();  
}  
};

function dragSetup(clip, targ) {  
clip.onPress = function() {  
startDrag(this);  
this.beingDragged=true;  
this.gotoAndStop(“over”);

```
    this.swapDepths(this.getNextHighestDepth());
};
clip.onRelease = clip.onReleaseOutside=function () {
    stopDrag();
    this.beingDragged=false; 
    if (eval(this._droptarget) == targ) {
        this.onTarget = true;    
        feedback.gotoAndPlay("correct");
        this.enabled = false;
        counter++;
    } else {
        this.onTarget = false;
        feedback.gotoAndPlay("incorrect");        
        this.gotoAndStop("hold");
    }
};
//the variables below will store the clips starting position
clip.myHomeX = clip._x;
clip.myHomeY = clip._y;
//the variables below will store the clips end position
clip.myFinalX = targ._x;
clip.myFinalY = targ._y;
clip.onEnterFrame = function() {
    //all these actions basically just say "if the mouse is up (in other words - the clip is not being dragged)
    // then move the MC back to its original starting point (with a smooth motion)"
    if (!this.beingDragged && !this.onTarget) {
        this._x -= (this._x-this.myHomeX)/5;
        this._y -= (this._y-this.myHomeY)/5;
        //if the circle is dropped on any part of the target it slides to the center of the target
    } else if (!this.beingDragged && this.onTarget) {
        this._x -= (this._x-this.myFinalX)/5;
        this._y -= (this._y-this.myFinalY)/5;
    }
};

```

}

dragSetup(item1,dropzone1);  
dragSetup(item2,dropzone2);  
dragSetup(item3,dropzone3);  
dragSetup(item4,dropzone4);
