This is the updated version of an old rubber bands file, now the lines do what they are supposed to. An added benefit is that I didn't need to feed the function any individual lines, they were generated automatically by the for loop. A planned distribution of lines can make this effect very interesting, instead of so annoying.
for(var i:int = 0; i<40; i++){
var newLine:MovieClip = new MovieClip();
var xPos:int = Math.random() * stage.stageWidth;
var yPos:int = Math.random() * stage.stageHeight;
setupLines(newLine, xPos, yPos, 0x00CBFF);
}
function setupLines(eachLine:MovieClip, posX:int, posY:int, color:Number):void {
eachLine.x = posX;
eachLine.y = posY;
eachLine.col = color;
eachLine.addEventListener(Event.ENTER_FRAME, updateLines);
}
function updateLines(e:Event):void {
var thisLine:MovieClip = MovieClip(e.currentTarget);
with(thisLine.graphics){
clear();
lineStyle(1, thisLine.col);
moveTo(0, 0);
lineTo(thisLine.mouseX, thisLine.mouseY);
addChild(thisLine);
}
}