To register for an Internet.com membership to receive newsletters and white papers, use the Register button ABOVE.
To participate in the message forums BELOW, click here


A Flash Developer Resource Site

Go Back   Flash Kit Community Forums > Flash Help > Flash ActionScript

Reply
 
Thread Tools Search this Thread Display Modes
Old 10-15-2004, 11:24 PM   #1
Adanufgail
Junior Member
 
Join Date: Oct 2004
Posts: 18
Drag and Drop Objects with Line Between

Hey all, I'm new here.

I was wondering if there was anyway to put a line between two or more dragable objects...
The only example I can think of is metroidprime.com.

Thanks,
Adanufgail
Adanufgail is offline   Reply With Quote
Old 10-16-2004, 12:38 AM   #2
jbum
Senior Member
 
jbum's Avatar
 
Join Date: Feb 2004
Location: Los Angeles
Posts: 2,920
Maybe you need to draw a picture then, cause I'm really not sure what you're asking for...
__________________
jbum is offline   Reply With Quote
Old 10-16-2004, 12:16 PM   #3
Adanufgail
Junior Member
 
Join Date: Oct 2004
Posts: 18
Basicly I'm looking for a way to have objects be draggable but keep a line (which I guess could be an object too) stretched in between them.

Adanufgail is offline   Reply With Quote
Old 10-16-2004, 01:46 PM   #4
jbum
Senior Member
 
jbum's Avatar
 
Join Date: Feb 2004
Location: Los Angeles
Posts: 2,920
This is a frame script. It assumes the blue square and the green square are movieclips that have been assigned the names mc1 and mc2.

If you want the lines to issue from a particular corner, orient the movieclips so that the crosshairs correspond to that corner.

I prefer to have the lines issue from the center (so I keep the crosshair centered).

code:

_root.createEmptyMovieClip("line_mc", 1);

MovieClip.prototype.drawLine = function()
{
this.clear();
this.lineStyle(2,0xFF0000,100);
this.moveTo(mc1._x, mc1._y);
this.lineTo(mc2._x, mc2._y);
}

// insure movieclips are in front of line
mc1.swapDepths(2);
mc2.swapDepths(3);

// draw initial line
line_mc.drawLine();

mc1.onPress = mc2.onPress = function()
{
this.startDrag();
line_mc.onEnterFrame = drawLine;
}

mc1.onRelease = mc2.onRelease = function()
{
delete line_mc.onEnterFrame;
this.stopDrag();
}

__________________
jbum is offline   Reply With Quote
Old 10-16-2004, 02:19 PM   #5
Adanufgail
Junior Member
 
Join Date: Oct 2004
Posts: 18
Yay! Thanks!
I tried to put a button inside the movie clip, but it doesn't seem to work...Any ideas?
Adanufgail is offline   Reply With Quote
Old 10-16-2004, 02:24 PM   #6
jbum
Senior Member
 
jbum's Avatar
 
Join Date: Feb 2004
Location: Los Angeles
Posts: 2,920
You tried to put a button inside which movieclip? The line?

Did you get the basic line drawing and dragging to work?
__________________
jbum is offline   Reply With Quote
Old 10-16-2004, 02:31 PM   #7
Adanufgail
Junior Member
 
Join Date: Oct 2004
Posts: 18
I got the basic line/drag to work.
I tried to put a button in the mc movieclip. I'm basicly building this little web of related items and when you click on an item, it pops open a window.
Adanufgail is offline   Reply With Quote
Old 10-23-2004, 09:47 PM   #8
Adanufgail
Junior Member
 
Join Date: Oct 2004
Posts: 18
Also, while I'm asking,
Is there anyway to get a movie clip (one that looks like a book, which I've designed already) to pop up after a button press and based on which button it is, put a specific text file in the book?
Adanufgail is offline   Reply With Quote
Old 05-27-2009, 03:37 PM   #9
dtone314
</hate>
 
dtone314's Avatar
 
Join Date: Jun 2005
Location: CA
Posts: 253
How would I go about modifying this code to handle four MCs? I'm imagining something that looks like dragging walls in a room where each MC is a corner of the room. Does that make sense? mc1 connects to mc2 which connects to mc3 which connects to mc4 which connects to mc1 again. Thanks for your help!
__________________
-dtøne-
Flash CS4 | AS2
Life is a journey, not a destination.
dtone314 is offline   Reply With Quote
Reply

Go Back   Flash Kit Community Forums > Flash Help > Flash ActionScript

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 01:36 PM.


internet.commerce
Be a Commerce Partner
 »  »  »  »  »  »  »
 »  »  »  »  »  »
 

    

Acceptable Use Policy


The Network for Technology Professionals

Search:

About Internet.com

Legal Notices, Licensing, Permissions, Privacy Policy.
Advertise | Newsletters | E-mail Offers


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.