# Slider Puzzle help!

**URL:** https://forum.kirupa.com/t/slider-puzzle-help/291942
**Category:** programming
**Created:** [July 8, 2009, 1:02am UTC](https://forum.kirupa.com/t/slider-puzzle-help/291942 "2009-07-08T01:02:19Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![sparrow\_5](https://avatars.discourse-cdn.com/v4/letter/s/f19dbf/32.png) [@sparrow\_5](https://forum.kirupa.com/u/sparrow_5)
#### Post date: [July 8, 2009, 1:02am UTC](https://forum.kirupa.com/t/slider-puzzle-help/291942/1 "2009-07-08T01:02:19Z")

</div>

So I have been somewhat successful in creating a slider puzzle, but i was wondering:  
how would i write a set of variables (x and y corodinates) for each tile in the correct place, and then being able to write the following:

if correctplacement gotoAndPlay 2

heres my script so far, it just moves the tiles around, and theres an issue with the vacant tile, but my main concern is dectecting if someone has won.

box1\_mc.onRelease = function(){  
var x:Number = this.\_x;  
var y:Number = this.\_y;  
this.\_x = empty\_mc.\_x;  
this.\_y = empty\_mc.\_y;  
empty\_mc.\_x = x;  
empty\_mc.\_y = y;  
}  
box2\_mc.onRelease = function(){  
var x:Number = this.\_x;  
var y:Number = this.\_y;  
this.\_x = empty\_mc.\_x;  
this.\_y = empty\_mc.\_y;  
empty\_mc.\_x = x;  
empty\_mc.\_y = y;  
}  
box3\_mc.onRelease = function(){  
var x:Number = this.\_x;  
var y:Number = this.\_y;  
this.\_x = empty\_mc.\_x;  
this.\_y = empty\_mc.\_y;  
empty\_mc.\_x = x;  
empty\_mc.\_y = y;  
}  
box4\_mc.onRelease = function(){  
var x:Number = this.\_x;  
var y:Number = this.\_y;  
this.\_x = empty\_mc.\_x;  
this.\_y = empty\_mc.\_y;  
empty\_mc.\_x = x;  
empty\_mc.\_y = y;  
}  
box5\_mc.onRelease = function(){  
var x:Number = this.\_x;  
var y:Number = this.\_y;  
this.\_x = empty\_mc.\_x;  
this.\_y = empty\_mc.\_y;  
empty\_mc.\_x = x;  
empty\_mc.\_y = y;  
}  
box6\_mc.onRelease = function(){  
var x:Number = this.\_x;  
var y:Number = this.\_y;  
this.\_x = empty\_mc.\_x;  
this.\_y = empty\_mc.\_y;  
empty\_mc.\_x = x;  
empty\_mc.\_y = y;  
}

box7\_mc.onRelease = function(){  
var x:Number = this.\_x;  
var y:Number = this.\_y;  
this.\_x = empty\_mc.\_x;  
this.\_y = empty\_mc.\_y;  
empty\_mc.\_x = x;  
empty\_mc.\_y = y;  
}  
box8\_mc.onRelease = function(){  
var x:Number = this.\_x;  
var y:Number = this.\_y;  
this.\_x = empty\_mc.\_x;  
this.\_y = empty\_mc.\_y;  
empty\_mc.\_x = x;  
empty\_mc.\_y = y;  
}
