startDrag outside of boundries problem (with source code)

trying to made a jigsaw puzzle, and using dynamic function to cut picture to pieces, but the pieces are not drag properly, except top-left coner one.

any one can help please.

ps:any good idea and suggestions on how to make a good jigsaw, please share with me, it’s my first game program in my life, i need your help.

sorry,file too big to upload,below is the code thanks in advance.:s:


for(i=1; i<10; i++){
    this.attachMovie("ad1", "pic"+i, 9+i, thumb);
    _root['pic'+i]._x = 5;
    _root['pic'+i]._y = 5;
    if(i>0 && i<4){
        _root['pic'+i].square._x=(i-1)*81;
        _root['pic'+i].square._y=0;
    }
    if(i>3 && i<7){
        _root['pic'+i].square._x=(i-4)*81;
        _root['pic'+i].square._y=81;
    }
    if(i>6 && i<10){
        _root['pic'+i].square._x=(i-7)*81;
        _root['pic'+i].square._y=162;
    }
    _root['pic'+i].onPress = function(){
        this.swapDepths(99);
        startDrag(this, false, 0, 0, 170, 170);//problems happends
    }
    _root['pic'+i].onRelease = function(){
        this.stopDrag();
    }
}