FORUMS: list search recent posts

Two draggable movieclips linked by line

COW Forums : Adobe Flash

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Graham Quince
Two draggable movieclips linked by line
on Sep 28, 2007 at 10:36:03 am

Hi everyone

Hoping you can help. The teachers at our school use software called Inspiration to create mindmaps. These are bubbles linked together by lines. It's an illustrative thought process. The problem is the software is appaling and has no display benefits at all. So i've been asked to make their files into Flash.
Currently I build in Flash 8, but we're upgrading to CS3 in about a month's time. Teachers are impatient however. :)

Basically, I need to be able to drag the outer movieclips around the screen and have the line remain attached to the central 'bubble'. I've seen this possible in some high-end flash games, does anyone know how?

Graham


Return to posts index

Graham Quince
Re: Two draggable movieclips linked by line
on Oct 2, 2007 at 7:19:59 am

Managed to find this solution on Flashkit's forums, works very nicely. Thought I'd post it here in case anyone else needs it.
All in the frame's actions:

_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);
}

// ensure 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();
}


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2018 CreativeCOW.net All Rights Reserved
[TOP]