// 예제 소스에서 잠시. 이렇게 Event 를 상속받는 클래스를 만든다.
// 이 클래스가 사용자 정의 이벤트를 구현한다.
package com.example.programmingas3.clock
{
import flash.events.Event;
/**
* This custom Event class adds a message property to a basic Event.
*/
public class AlarmEvent extends Event
{
/**
* The name of the new AlarmEvent type.
*/
public static const ALARM:String = "alarm";
/**
* A text message that can be passed to an event handler
* with this event object.
*/
public var message:String;
/**
* Constructor.
* @param message The text to display when the alarm goes off.
*/
public function AlarmEvent(message:String = "ALARM!")
{
super(ALARM);
this.message = message;
}
... 중략
} // package 괄호 종료..
자 그렇다면 어떻게 사용할까?
imort AlarmEvent;
myButton.addEventListener(AlarmEvent.ALARM, onAlram);
끝... 간단해서 정말 좋다...
// 이 클래스가 사용자 정의 이벤트를 구현한다.
package com.example.programmingas3.clock
{
import flash.events.Event;
/**
* This custom Event class adds a message property to a basic Event.
*/
public class AlarmEvent extends Event
{
/**
* The name of the new AlarmEvent type.
*/
public static const ALARM:String = "alarm";
/**
* A text message that can be passed to an event handler
* with this event object.
*/
public var message:String;
/**
* Constructor.
* @param message The text to display when the alarm goes off.
*/
public function AlarmEvent(message:String = "ALARM!")
{
super(ALARM);
this.message = message;
}
... 중략
} // package 괄호 종료..
자 그렇다면 어떻게 사용할까?
imort AlarmEvent;
myButton.addEventListener(AlarmEvent.ALARM, onAlram);
끝... 간단해서 정말 좋다...