Actionscript exercise with a line connecting movable movieClips.
Flash Example
actionscript
[cc lang=”actionscript” tab_size=”2″ lines=”40″]
// get x and y coordinates of the circles
var ax = _root.point1._x;
var ay = _root.point1._y;
var bx = _root.point2._x;
var by = _root.point2._y;
var cx = _root.point3._x;
var cy = _root.point3._y;
// draw line between them
_root.createEmptyMovieClip (“line”, 0);
with (_root.line){
lineStyle (1, 0x999999, 100);
moveTo (ax, ay);
lineTo (bx, by);
lineTo (cx, cy);
lineTo (ax, ay);
}
[/cc]