PDA

View Full Version : detect a location



daytonatkf
August 30th, 2006, 04:23 AM
how to set that this mc already reach a y location (x,y)?

timboros82
August 30th, 2006, 07:14 AM
huh?

lewi-p
August 30th, 2006, 07:42 AM
I think they wanna know how to tell if a movieclip has reached a certain x/y point on the stage...if thats right, here's how you do it. (using a movieclip called "my_mc")



var xPos = 100; //Desired X Position
var yPos = 100; //Desired Y Position
///
this.onEnterFrame = function() {
if ((my_mc._x == xPos) && (my_mc._y == yPos)) {
trace("my_mc has reached x:"+xPos+" & y:"+yPos);
delete this.onEnterFrame;
}
};

Hope this helps

timboros82
August 30th, 2006, 08:57 AM
what is the trace thing doing?...and why do you "delete.this" on frame enter?