package {
import flash.display.Sprite;
import flash.events.Event;
import flash.events.MouseEvent;
import flash.text.TextField;
public class ExampleApplication extends Sprite
{
private var _sprite:Sprite;
private var _textField:TextField;
public function ExampleApplication()
{
_sprite = new Sprite();
addChild(_sprite);
_sprite.graphics.beginFill( 0xffffff);
_sprite.graphics.drawRect(260, 180, 50, 50);
_sprite.graphics.endFill();
_textField = new TextField();
addChild(_textField);
_textField.x = 270;
_textField.y = 195;
_textField.text = "stop";
graphics.lineStyle( 1, 0, 1 );
addEventListener(Event.ENTER_FRAME, onEnter);
_textField.addEventListener(MouseEvent.CLICK, onClick);
}
private function onEnter( e:Event ):void
{
graphics.lineTo( Math.random() * 540, Math.random() * 400 )
}
private function onClick( e:MouseEvent ):void
{
removeEventListener( Event.ENTER_FRAME, onEnter );
}
}
}
lineTo와 랜덤 함수를 이용한 무한 선긋기.....계속 두면 cpu가 싫어할듯..
재미있는 작업이 가능할거 같다~
'AS3 > ActionScript' 카테고리의 다른 글
| removeChild, removeEventListener를 통한 메모리상 객체지우기 (0) | 2009.04.20 |
|---|---|
| 키보드 제어 (0) | 2009.04.20 |
| 사인/코사인을 이용한 원그리기 (8) | 2009.03.15 |
| 두점 사이 거리값 구하기 (0) | 2009.03.14 |
| lineTo와 moveTo를 활용한 그림판 만들기 (0) | 2009.02.18 |