5 Replies Latest reply on Jun 25, 2008 8:13 PM by clbeech

# connecting movable buttons by a  line?

Hi all beginner here
I have created 2 circular buttons that i can drag and drop anywhere.....(basic stuff).
I would like to create a dashed or solid line that connects to their centers which changes in length
as I or user moves the buttons around each other. Does anyone have any suggestions on how to approach this problem. Can I do this in action scripting?
Any ideas? tips, tricks, tutorials or directions that anyone knows of?
thank you.
I am using Flash 8
• ###### 1. Re: connecting movable buttons by a  line?
This could work
• ###### 2. Re: connecting movable buttons by a  line?
WOW!!!
Thanks rlc5611 !
Thanks for your labor. I have since studied it and its very helpfull !
Thanks again!
• ###### 3. Re: connecting movable buttons by a  line?
yep - not too shabby there rlc - but you could make the drawing method a bit more concise with something like this:
• ###### 4. connecting movable buttons by a  line?
Hi clbeech
I will have to look at yours as well. Thank you. One of the next phases of my project is to study the info found here:
http://blog.circlecube.com/2008/02/15/distance-formula-in-actionscript-tutorial-pythagorea n-theorem/
and find the length of the line as the circles are moved to different locations.
If you feel like another challenge I would be curious what you would come up with.
:)
• ###### 5. Re: connecting movable buttons by a  line?
to find the distance of the line - you can use the Pythagorean theorem, or the Point.distance method. The Pythagorean theorem states: a^2 + b^2 = c^2 - so you can get the distance by finding the x/y distances between the two circles, add them and get the square root. or use the Point class and distance method - I'll show both below: