Graphics Programming

Event 클래스 상속하기 본문

Season 1/플래시

Event 클래스 상속하기

minseoklee 2010. 4. 25. 23:03

간단한 건데 자꾸 까먹네 ㅡㅡ

clone(), toString() 메서드를 재정의한다.

class CustomEvent {

  public function CustomEvent(type:String, bubbles:Boolean, cancelable:Boolean, 추가매개변수1, 추가매개변수2) {
    super(type, bubbles, cancelable) // bubbles랑 canceable이 필요 없으면 매개변수로 받지 말고 그냥 false나 넘겨버리자
    // 추가 조작
  }

  public override function clone( ):Event {
    return new CustomEvent(type, bubbles, cancelable, 추가매개변수1, 추가매개변수2)
  }

  public override function toString( ):String {
    // 표시하고 싶은 변수 이름들을 두서 없이 넘기면 된다.
    return formatToString("CustomEvent", "type", "bubbles", "cancelable", "eventPhase", "추가매개변수1", "추가매개변수2")
  }

}

Comments