LineDraw
線の描画です。
// forked from gonaznable7's Sample03
package
{
import flash.display.Sprite;
import flash.events.Event;
public class Test extends Sprite
{
public function Test()
{
var line:Line = new Line();
addChild(line);
}
}
}
import flash.events.Event;
import flash.display.Sprite;
import flash.display.MovieClip;
/*class ChildSprite extends Sprite
{
public function ChildSprite()
{
graphics.beginFill(0xFF0000);
graphics.drawCircle(200,200,100);
graphics.endFill();
addEventListener(Event.ENTER_FRAME, doEnterFrame);
}
private function doEnterFrame(e:Event):void{
e.target.x += 0.5;
}
}*/
class Line extends Sprite
{
public var i:int = 0;
public function Line()
{
graphics.lineStyle(3, 0x000000);
graphics.moveTo(0, 0);
graphics.lineTo(200,200);
addEventListener(Event.ENTER_FRAME, dodoEnterFrame);
}
public function drawLine(j:int, k:int):void
{
graphics.lineStyle(3, 0x000000);
graphics.moveTo(j, k);
graphics.lineTo(200,200);
addEventListener(Event.ENTER_FRAME, dodoEnterFrame);
}
private function dodoEnterFrame(e:Event):void
{
i++;
e.target.graphics.clear();
e.target.drawLine(i ,i);
}
}