Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do I make a moveclip stop inside a specific target zone?

Status
Not open for further replies.

caddystorage

Technical User
Apr 17, 2008
1
AU
Hi, I'm a newbie to Flash. anyways, i need to make a movieclip stop inside a specific ztarget zone. At the moment the movieclip stops even if you are just partially touching the target area. How do I get it to stop (or bump into) only the target zone so that it stop at the same location everytime?

This is my code so far :

ball2.onPress = function() {
this.startDrag(true);
reply_txt.text = "";
this.swapDepths(this.getNextHighestDepth());
xstart = this._x;
ystart = this._y;
};
onEnterFrame = function () {
if (counter == 2) {
reply_txt.text = "Congrats, you're finished!";
}
};
ball2.onRelease = function() {
this.stopDrag();
if (eval(this._droptarget) == box) {
duplicateMovieClip("ball2","shelf",10)
onEnterFrame = function(){
shelf._x += xmove;
}

; reply_txt.text = "THIS FITS";

this.enabled = false;
} else {
reply_txt.text = "DOES NOT FIT";
this._x = xstart;
this._y = ystart;
}
wheel.swapDepths(this.getNextHighestDepth());
};
ball3.onPress = function() {
this.startDrag(true);
reply_txt.text = "";
this.swapDepths(this.getNextHighestDepth());
xstart = this._x;
ystart = this._y;
};
ball3.onRelease = function() {
this.stopDrag();
if (eval(this._droptarget) == box2) {
reply_txt.text = "THIS FITS";
this.enabled = false;
} else {
reply_txt.text = "DOES NOT FIT";
this._x = xstart;
this._y = ystart;
}
wheel.swapDepths(this.getNextHighestDepth());
};
ball.onPress = function() {
this.startDrag(true);
reply_txt.text = "";
this.swapDepths(this.getNextHighestDepth());
xstart = this._x;
ystart = this._y;
};
ball.onRelease = function() {
this.stopDrag();
if (eval(this._droptarget) == box3) {
reply_txt.text = "THIS FITS";
this.enabled = false;
} else {
reply_txt.text = "DOES NOT FIT";
this._x = xstart;
this._y = ystart;
}
wheel.swapDepths(this.getNextHighestDepth());
};


Thanks in advance.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top