본문 바로가기

AS

Shape 와 Sprite 차이

상속성의 차이
Shape Inheritance DisplayObject Inheritance EventDispatcher Inheritance Object
Sprite Inheritance DisplayObjectContainer Inheritance InteractiveObject Inheritance DisplayObject Inheritance EventDispatcher Inheritance Object

Shape 클래스는 ActionScript 드로잉 API를 사용하여 가벼운 모양을 만드는 데 사용됩니다. Shape 클래스에는 Graphics 클래스의 메서드에 액세스할 수 있게 해 주는 graphics 속성이 포함됩니다.

또한 Sprite 클래스는 graphics 속성뿐만 아니라 Shape 클래스에서 사용할 수 없는 다른 기능을 포함합니다. 예를 들어, Sprite 객체는 표시 객체 컨테이너이고 Shape 객체는 표시 객체 컨테이너가 아닙니다(자식 표시 객체를 포함하지 않음). 이러한 이유로 Shape 객체는 동일한 그래픽을 포함하는 Sprite 객체보다 메모리를 적게 사용합니다. 그러나 Sprite 객체는 마우스 클릭 이벤트를 지원하고 Shape 객체는 지원하지 않습니다.