Hey I was wondering. Say I made 2 circles that were draggable, how would i make it so a line would stay connected to both circles at all times? Ok thanks!
assuming that the instances of the circles are circleA and circleB…
this.createEmptyMovieClip("line", -1);
line.onEnterFrame = function() {
this.clear();
this.lineStyle(1, 0, 100);
this.moveTo(circleA._x, circleA._y);
this.lineTo(circleB._x, circleB._y);
};
just paste the script and change the instance names if needed. =)
Hey thanks! Im at school right now, but I’ll give that a try as soon as i get home! Thanks again!
kax: You should do line.onMouseMove instead of line.onEnterFrame. Since the clips are just draggable the only time they will move is when the mouse moves, so why keep an onEnterFrame running when there is no need?
ok… let me know if you have any problems.
good point, lost. honestly i didn’t read the whole post… i just took a quick look and replied.
Well either way, they both work
WOW!!! so easy!!!
the method i learned a while back was so complicated i gave up on trying to remember how it was done…
now i can think about this again
yup. :beam:
revenge??
http://www.kirupaforum.com/forums/showthread.php?s=&threadid=20960
Originally posted by markcq
**WOW!!! so easy!!!
the method i learned a while back was so complicated i gave up on trying to remember how it was done…
now i can think about this again
**
now you know… there’s always an easier way. :beam:
ok, i’ve taken this line thing further…
i added the script below to each instance of the circle (now the circles will run away from the mouse)
problem is that some times the circles move too fast for the line… any suggestions?
onClipEvent(load){
homeX = this._x
homeY = this._y
magnet = 1000
}
onClipEvent(enterFrame){
x0 = this._x
y0 = this._y
x1 = _root._xmouse
y1 = _root._ymouse
distancex = x1-x0
distancey = y1-y0
distance = Math.sqrt((distancex * distancex) + (distancey * distancey))
powerx = this._x - (distancex / distance) * magnet / distance
powery = this._y - (distancey / distance) * magnet / distance
forcex = (forcex + (homex - x0) / 2) / 1.66
forcey = (forcey + (homey - y0) / 2) / 1.66
this._x = powerx + forcex
this._y = powery + forcey
}
*Originally posted by kax *
**yup. :beam:
revenge??
http://www.kirupaforum.com/forums/showthread.php?s=&threadid=20960 **
Actually not intentionally… but sure… you could call it that :P…lol
j/k, it wasn’t revenge, because revenge is getting someone back who has wronged you, and well… you didn’t wrong me… you corrected my wrong
got it right!!!
this is a variation on the theme… it works though. hehehe
I feel like a cat… playing with a spring…
meaow! :evil: (hey, just imagine this is a cat icon) hehehe…
i like the small things… you know what they say about small things and small minds…