# Drag&drop compare arrays

**URL:** <https://forum.kirupa.com/t/drag-drop-compare-arrays/328364>\
**Category:** Uncategorized\
**Created:** [May 11, 2012, 8:56am UTC](https://forum.kirupa.com/t/drag-drop-compare-arrays/328364 "2012-05-11T08:56:23Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![eva\_tw](https://avatars.discourse-cdn.com/v4/letter/e/ec9cab/32.png) [@eva\_tw](https://forum.kirupa.com/u/eva_tw)\
**Post date:** [May 11, 2012, 8:56am UTC](https://forum.kirupa.com/t/drag-drop-compare-arrays/328364/1 "2012-05-11T08:56:23Z")

</div>

Hi,

I’ve made a drag&drop puzzle where you can drop the drags on all targets. Then a button becomes visible and the goal is, when you click this button, it checks if the matches are correct.  
The drags and the drops are in two arrays, so I need the check-function to compare if the position of the drags and the drops are the same. I just don’t know how to describe this in actionscript…

Here is part of my code:

```auto

var dragArray:Array = [drag_stap1, drag_stap2, drag_stap3, drag_stap4, drag_stap5];
var matchArray:Array = [drop_stap1, drop_stap2, drop_stap3, drop_stap4, drop_stap5];

var startX:Number;
var startY:Number;
var counter:Number = 0;

btn_controleren.visible=false;
goed_stap12345.visible=false;

for(var i:int = 0; i < dragArray.length; i++) 
	{
	dragArray*.buttonMode = true;
	dragArray*.addEventListener(MouseEvent.MOUSE_DOWN, pickUp);
	dragArray*.addEventListener(MouseEvent.MOUSE_UP, dropIt);
	}

//here I describe the pickUp and dropIt function, but that is already working :)

function controleer(event:MouseEvent):void{

	var index:int
	for each (index in dragArray)

	if (matchClip != dragArray[index])
		{
		dragArray*.x = startX;
		dragArray*.y = startY;
		dragArray*.buttonMode = true;
		dragArray*.addEventListener(MouseEvent.MOUSE_DOWN, pickUp);
		dragArray*.addEventListener(MouseEvent.MOUSE_UP, dropIt);
		txt_hint.visible = true;
		txt_hint.text = "Nog niet alles zit op de juiste plek, probeer het nog eens!";
		}
	
	if (matchClip == dragArray[index])
		{
		btn_controleren.visible = false;
		goed_stap12345.visible = true;
		}
}

```

I hope someone can explain to me how I should do this!
