Slider Puzzle help!

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;
}