Hi I’m Trying to develop a small game where the user chooses from a range of boxes of the left of screen and can drag 3 of them separatley to 3 holding boxes on ther right. each box can be dragged to any location and the order is not important. Once the 3 holding boxes are all full I want a new button to appear. I have some draggable boxes but for some reason they wont snap to the locations. Below is a a link to the file and a list of the instance names of the movie clips plus my actionscript. Any help would be really appreciated. Cheers
LINK
http://www.sainters.net/flash_preview/flash_test/flash test_v6.fla.zip
box 1 = “circle_mc”
box 2 = “circle_mc2”
top grey box = “targetCircle1”
bottom grey box = “targetCircle2”
ACTIONSCRIPT
function dragSetup(clip, targ) {
clip.onPress = function() {
startDrag(this);
this.beingDragged=true;
};
clip.onRelease = clip.onReleaseOutside=function () {
stopDrag();
this.beingDragged=false;
if (this._droptarget.isTarget) {
this._droptarget.isTarget = false;
_root.targ.gotoAndStop(2);
} else {
this.onTarget = false;
_root.targ.gotoAndStop(1);
}
};
//the variables below will store the clips starting position
clip.myHomeX = clip._x;
clip.myHomeY = clip._y;
//the variables below will store the clips end position
clip.myFinalX = targ._x;
clip.myFinalY = targ._y;
clip.onEnterFrame = function() {
//all these actions basically just say “if the mouse is up (in other words - the clip is not being dragged)
// then move the MC back to its original starting point (with a smooth motion)”
if (!this.beingDragged && !this.onTarget) {
this._x -= (this._x-this.myHomeX)/5;
this._y -= (this._y-this.myHomeY)/5;
//if the circle is dropped on any part of the target it slides to the center of the target
} else if (!this.beingDragged && this.onTarget) {
this._x -= (this._x-this.myFinalX)/5;
this._y -= (this._y-this.myFinalY)/5;
targetCircle1.isTarget == true;
targetCircle2.isTarget == true;
}
}
}
**dragSetup(circle_mc); // left off second argument purposefully
dragSetup(circle_mc2);**