I have 6 clips I want to drag and drop into 1 main target area. Once a clip is dropped into the main target area, i want it to disappear (i did achieve this part by setting the visibility to false ) and have a specific movie clip play in the main target area. The clips to drag are laid out on the stage similar to a Mac OS X dock. Lets call them A, B, C, D, E, F. I got the drag and drop portion to work smoothly. If the dragged clip is not in the target area it will smoothly animate back to its original location. Let’s say the user drags A into the main target area and the subsequent movie plays…I want the user to be able to drag and drop B, C, D, E, or F into the target triggering their respective movie clip and returning (animating) the previous clip they dragged back to its original spot. So far I have only been able to 1) make each clip draggable into its target (and if the user misses, it animates back smoothly) 2) make its respective movie play. As of now this can only be used in a linear fashion.
Once the user drags a clip into the main target area and the subsequent movie plays…I want the user to be able to drag and drop any one of the other clips into the target triggering their respective movie clip and returning (animating) the previous clip they dragged back to its original spot. HELP please? Thanks in advance-Michael
Here is my code so far:
function dragSetup(clip, targ) {
clip.onPress = function() {
startDrag(this);
this.beingDragged=true;
this.shadow_mc._alpha=100;
};
clip.onRelease = clip.onReleaseOutside=function () {
stopDrag();
this.beingDragged=false;
if (eval(this._droptarget) == targ) {
this.onTarget = true;
projectHolder.attachMovie(this._name, "project", 1);
this._visible=false;
maintext._alpha=0;
} else {
this.onTarget = false;
this.shadow_mc._alpha=0;
this._visible=true;
}
};
//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;
}
}
};
}