Dragging two Segments

"Drag" has to know which segment to use, and x, y point of where its being dragged to.
You need to: drag segmentU to mouseX, mouseY and segmentD to mouseU.x, mouseU.y

package {
    import flash.display.Sprite;
    import flash.events.Event;

    public class DosSegmentDrag extends Sprite
    {
        private var segmentU:Segment;
        private var segmentD:Segment;

        public function DosSegmentDrag()
        {
            init();
        }

        private function init():void
        {
            segmentU = newSegment(200, 30);
            addChild(segmentU);
            segmentD = newSegment(200, 30);
            addChild(segmentD);
            addEventListener(Event.ENTER_FRAME, onEnterFrame);
        }

        private function onEnterFrame(event:Event):void
        {
            drag(segmentU, mouseX, mouseY);
            drag(segmentD, mouseU.x, mouseU.y);
        }

        private function drag(segment:Segement, xpos:Number, ypos:Number):void
        {
            var dx:Number = xpos - segment.x;
            var dy:Number = ypos - segment.y;
            var angle:Number = Math.atan2(dy, dx);
            segment.rotation = angle * 180 / Math.PI;

            var w:Number = segment.getPin().x - segment.x;
            var h:Number = segment.getPin().y - segment.y;
            segment.x = xpos - w;
            segment.y = xpos - h;
        }
    }
}

later gator...