I have a line randomly being drawn and moved across the stage. Here is the code:
import flash.display.Sprite;
var xValue:Number = 0;
var yValue:Number = 150;
//sprite in which the line will be created
var edgeHolder:Sprite = new Sprite();
addChild(edgeHolder);
//define lineStyle and starting positon
edgeHolder.graphics.lineStyle(3,0x00bb00);
edgeHolder.graphics.moveTo(xValue,yValue);
edgeHolder.addEventListener(Event.ENTER_FRAME, drawRandom);
function drawRandom(event:Event):void {
//reassign the x and y positions
xValue+=10;
yValue = 100 + (Math.random()*150);
// draw the line to the next point
edgeHolder.graphics.lineTo(xValue,yValue);
//move edgeHolder to the left once the line is across the entire stage
if(xValue>=stage.stageWidth) {
edgeHolder.x-=10;
}
}
Is there any simple way to create a filled in shape that covers the entire area of the stage above the line being created? Or any other way of filling in this space?
Thanks.