Drag and Drop Stuff

Good afternoon folks(well it is here anyway)

My scenario is I’m building a D&D question where there are 6 draggable options and two available empty slots.

I have 2 questions for you nice people.

Firstly, just say i drag ‘option1’ to ‘Target A’ and then do the same with ‘option 2’ …whats the most efficient way to dump ‘option 1’ out of targetA…ie i dont want more than one option being able to reside in a target at any one time.

Secondly, currently i have the options snapping back to their origins if they’re not released on either target…i’d really love to have them slide back to the origin position instead of snapping. I’ve seen this done in an .fla that i found on flashkit I think but its beyond me.(i’ll attach it anyway)

anyway the code currently on my options is this:

on (press) {
startDrag("", false, 20, 500, 550, 725);
}
on (release) {
stopDrag();
if (this._droptarget == “/targetA”) {
setProperty(this, _x, 412);
setProperty(this, _y, 505);
} else if (this._droptarget == “/targetB”) {
setProperty(this, _x, 145);
setProperty(this, _y, 520);
} else {
setProperty(this, _x, 30);
setProperty(this, _y, 560);
}
}

Thanks for reading.

How are you loading the droppped objects into their spaces?

You could use attachMovie or LoadMovie and it would bump out whatever is already in the space. Eg.
[AS]
on(press){
this.startDrag();
}
on(release){
if(this.hitTest(_root.target)){
_root.target.attachMovie(mc, “mc” + i, i);
this.targetX = initX;
this.targetY = initY;
}else{
this.targetX = initX;
this.targetY = initY;
}
}
onClipEvent(load){
initX = this._x;
initY = this._y;
targetX = this._x;
tagrteY = this._y;
}
onClipEvent(enterFrame){
this._x = (targetX - this._x).1;
this._y = (targetY - this._y)
.1;
}
[/AS]
This will make the mc return to it’s original position, but it will also slow down as it approaches its target, so if you want it to go at a constant speed, play with the onClipEvent(enterFrame) script.

C