I am working on a project where I have several movie clips that the user can drag, but I’m trying to keep them confined in a circular area. I tried creating a movie clip that contains a shape of the surrounding area, and I figured I could set up a simple hitTest statement that detects when one of the mc’s is trying to leave the designated area. However, I cannot get it to work. Right now I’m just trying to have the computer print out some output when a hit is detected. Below is my code. Any ideas?
[SIZE=1]function dragStarter():Void {
this.startDrag();
this.onMouseMove = updateAfterEvent;
}
function dragStopper():Void {
this.stopDrag();
delete this.onMouseMove;
}
[SIZE=2]
// THIS IS THE FUNCTION THAT IS LOOKING FOR ANY HITS
function checkBoundary():Void {
if (this.hitTest(boundary_mc._x, boundary_mc._y, true)) {
trace(“hit”);
}
}[/SIZE]
function attachDragScripts():Void {
this.onPress = dragStarter;
this.onRelease = dragStopper;
this.onReleaseOutside = dragStopper;
this.onEnterFrame = checkBoundary;
}
for (var i = 1; i <= 26; i++) {
attachDragScripts.apply(_root[“letter”+i+"_mc"]);
_root[“letter”+i+"_mc"]._x = 100 + (Math.random() * 400);
_root[“letter”+i+"_mc"]._y = 110 + (Math.random() * 210);
if (i % 2 == 0) {
_root["letter"+i+"_mc"]._rotation = (Math.random() * 15);
} else {
_root["letter"+i+"_mc"]._rotation = (Math.random() * -15);
}
}[/SIZE]