package{ import flash.display.Sprite; import flash.events.*; public class Oks1 extends Sprite{ public var oks:Oks1; public var oks2:Oks1; public var nurk:Number=0; public function Oks1(){ addEventListener(Event.ENTER_FRAME, liigu); } public function liigu(e:Event):void{ nurk+=0.01; oks.rotation=20*Math.sin(nurk); oks.rotation=-20*Math.sin(nurk); } public function joonistaOks(x2:Number, y2:Number):void{ graphics.clear(); graphics.lineStyle(1, 0, 1); //paksus, värv, nähtavus graphics.lineTo(x2, y2); if(Math.sqrt(x2*x2+y2*y2)>5){ var rvx:Number=y2; var rvy:Number=-x2; oks=new Oks1(); oks.joonistaOks(x2/2+rvx/2, y2/2+rvy/2); addChild(oks); oks.x=x2; oks.y=y2; oks2=new Oks1(); oks2.joonistaOks(x2/2-rvx/2, y2/2-rvy/2); addChild(oks2); oks2.x=x2; oks2.y=y2; } } } }