Mega Code Archive

 
Categories / Flash ActionScript / Class
 

Create a method and then call it by name

package {     import flash.display.Sprite;     public class Main extends Sprite     {         public function Main(  ) {             for(var i:int=0;i<10;i++) {                 drawLine(  );             }         }              private function drawLine(  ):void {             graphics.lineStyle(1, Math.random(  ) * 0xffffff, 1);             graphics.moveTo(Math.random(  ) * 400, Math.random(  ) * 400);             graphics.lineTo(Math.random(  ) * 400, Math.random(  ) * 400);         }     } }