hitTest() Problem

Hi Guys,

Here’s what I’m trying to achieve. I am creating an application that will make duplicates of an attached movie when a button is pressed, with each movie assigned its own unique identifer (movie 1, movie0 etc…). The maximum movies that can be created is 7 and once it hits this number I want and the button to be disabled. Once the movie is dragged over a particular area (hitTest) I want to delete the movie and decrement the value by 1. Once the movie reaches 0 the button becomes enabled once again.

The problem is when I attach a movie and its dragged over the hitTest area and I press the button once again the x and y coordinates shift.

Can someone help me out please.

Thanks

Heres the code:

var i:Number = 0;

function createmovie() {
_root.attachMovie(“blue”,“testmovie”+ i,this.getNextHighestDepth());
_root[“testmovie” + i]._x = Stage.width/2;
_root[“testmovie” + i]._y = Stage.height/2;

_root["testmovie" + i].onPress = function() {
    this.startDrag();
    this._alpha = 50;
};

_root["testmovie" + i].onRelease = function() {
    this.stopDrag();
    this._alpha = 100;

    if (this.hitTest(trash)) {
        this._visible = false;
        i--;
        trace(i);
    }
};

_root["testmovie" + i].onReleaseOutside = function() {
    this.stopDrag();
    this._alpha = 100;
};

trace(i);

}

pressmebtn.onRelease = function() {
i++;
createmovie();

if(this) {
_root["testmovie" + i]._x = Stage.width/2;
_root["testmovie" + i]._y = Stage.height/2;
}

};