473,396 Members | 1,805 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Drag n Drop using arrays for multiple movieclips

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).
Sep 3 '08 #1
0 2673

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Lauren Quantrell | last post by:
I'm trying to drop a file from Windows Explorer (or desktop, etc.) onto a field in Access2K and capture the full file path. I found an posting below that says this is possible but I cannot...
1
by: emferrari | last post by:
Hi everybody I have two treeviews, one of them is only to receive items dragged from the treeview1. I want to know how to drag a full node information to the treeview2. I know how to do that...
1
by: Ramesh Chawla | last post by:
Hi, I have to implement the functionality like 'drag n drop' in asp.net form. It is like, a table will be shown to the user at the client side. the first and last column of the table at the client...
3
by: James Radke | last post by:
Hello, I was curious, is it possible to create drag and drop interface from listbox to listbox on a webform application (i.e. vb.net)? Basically the application would need to load multiple...
1
by: Terry Olsen | last post by:
My first time using TreeViews. I have TreeView1 set up to display my directory structure just like Windows Explorer. I can drag & drop files and folders over to TreeView2. I can re-arrange the...
3
by: petermichaux | last post by:
Hi, I am trying to put together the last major pieces of my project's puzzle. This is more website/client-side architecture than JavaScript syntax but I hope this is a good place to ask. I'm a...
3
by: Rob | last post by:
I've searched for info on how to drag and drop a group of strings (or any other object) from one control to another. Looked through articles by Dino Esposito, checked the Forms books by Sells and...
2
by: anchi.chen | last post by:
Hi People, Just wondering if any of you have ever come across any javascript examples that will allow one to drag and drop multiple items between lists? That is, users would be able to use the...
0
by: =?Utf-8?B?UHVjY2E=?= | last post by:
Hi, I'm using vS2005 and .net 2.0. for a Windows application. I'm implementing a Drag and Drop between 2 DataGridView controls. It's working fine with just one item being drag and drop. I want...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.