# Multiple snap target help

**URL:** <https://forum.kirupa.com/t/multiple-snap-target-help/42429>\
**Category:** Uncategorized\
**Created:** [February 9, 2004, 5:06am UTC](https://forum.kirupa.com/t/multiple-snap-target-help/42429 "2004-02-09T05:06:58Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![bugjuice](https://avatars.discourse-cdn.com/v4/letter/b/d78d45/32.png) [@bugjuice](https://forum.kirupa.com/u/bugjuice)\
**Post date:** [February 9, 2004, 5:06am UTC](https://forum.kirupa.com/t/multiple-snap-target-help/42429/1 "2004-02-09T05:06:58Z")

</div>

hey flash gurus i have a question i have a block that i want to snap to a tightly to 64 boxes on a "fake isometric grid "

–the boxes have instance names of snap1 snap2 snap 3 etc

–heres the code i came up with can someone help me out it isnt working for some reason the reason why i want to do it this way is because i was handcoding the xand y quardinate of each drop target now i want to make it more dynamic so i think i want one script for all the droptargets

–also it must be a for loop problem because all i want flash to do is snap to the nearest point on the grid

this.onRelease=function(){  
var snap =myarray.length;  
for(var i = 0; i\< 64; i++){  
gridName = “snap” + i;  
abs\_x = Math.abs(loc\_x-x);  
abs\_y = Math.abs(loc\_y-y);  
if (abs\_x\>28 || abs\_y\>17) {  
if (eval(this.\_droptarget) == “snap”) {  
\_x = loc\_x;  
\_y = loc\_y;  
music = new Sound();  
music.attachSound(“click6”);  
music.start(0, 1);  
setProperty(this, \_alpha, 100);  
trace(“pointsnapping”);  
}  
}

–by the way the fla file thats posted only works for the 2x2s white to give you an example of what im trying to do

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [February 9, 2004, 12:42pm UTC](https://forum.kirupa.com/t/multiple-snap-target-help/42429/2 "2004-02-09T12:42:56Z")

</div>

can someone at least post a tutorial
