Can any one help me how to do drag and drop for multiple movie clips which are inserted dynamically. (Like match the following for example For question A (which is in lift side of the stage) answer is B5(which is in right side of the stage)). When i drag the question A line should be generate from the the drag position. Please check the code attached with this.
[code]...
a = 0;
b = 0;
depth = 1000;
for (i=0; i<6; i++) {
if (i<3) {
var box_mc = "box_mc"+i;
_root.attachMovie("box_mc", box_mc, depth++);
a++;
eval(box_mc)._x = 100;
eval(box_mc)._y = 50*a;
} else {
var rbox_mc = "rbox_mc"+i;
_root.attachMovie("rbox_mc", rbox_mc, depth++);
b++;
eval(rbox_mc)._x = 200;
eval(rbox_mc)._y = 50*b;
}
}
xArray = new Array("box_mc0", "box_mc1", "box_mc2");
yArray = new Array("rbox_mc3", "rbox_mc4", "rbox_mc5");
this.createEmptyMovieClip("line_mc", this.getNextHighestDepth());
var flag = false;
for (i=0; i<=2; i++) {
eval("box_mc"+i).onPress = function() {
startDrag(this);
//trace(this);
this.swapDepths(depth++);
posX = this._x;
posY = this._y;
eval("box_mc"+i).onEnterFrame = function() {
if (flag == true) {
line_mc.lineStyle(1, 0x000000, 100);
line_mc.moveTo(posX, posY);
line_mc.lineTo(this._x, this._y);
}
};
};
posX = this._x;
posY = this._y;
flag = true;
eval("box_mc"+i).onRelease = function() {
this.stopDrag();
//trace(this);
delete eval("box_mc"+i).onEnterFrame;
if (eval(this._droptarget) == ("rbox_mc"+i)) {
} else {
this._x = posX;
this._y = posY;
}
};
}
But i am not able to trace the value of ("rbox_mc"+i).