| Package | mx.core |
| 인터페이스 | public interface IPropertyChangeNotifier extends IEventDispatcher , IUID |
| Subinterfaces | IManaged |
| 인프리멘타 | ObjectProxy , UIComponent |
IPropertyChangeNotifier 인터페이스는, 마커 인터페이스를 정의합니다. 이 인터페이스를 지원(support)하는 클래스는, 특수한 방법에서의 이벤트의 전파의 지원(support)를 선언합니다. 이 인터페이스를 Implements하는 클래스는, 이 클래스의 property마다, 및 property로서 공개되고 있는 네스트 된 클래스의 property 마다 이벤트를 dispatch할 필요가 있습니다. 익명의 (복잡해, 엄밀하게 형태 지정되어 있지 않다) property의 경우는, Implements하는 클래스가 custom 지원(support)를 제공하는지, ObjectProxy 클래스를 직접 사용합니다. 이 인터페이스의 Implements자는,PropertyChangeEvent.createUpdateEvent() Methods를 사용해, dispatch에 대한 적절한 갱신 이벤트를 작성할 필요가 있습니다.
function set myProperty(value:Object) :void
{
var oldValue:IPropertyChangeNotifier = _myProperty;
var newValue:IPropertyChangeNotifier = value;
// Need to ensure to dispatch changes on the new property.
// Listeners use the source property to determine which object
// actually originated the event.
// In their event handler code, they can tell if an event has been
// propagated from deep within the object graph by comparing
// event.target and event.source. If they are equal, then the property
// change is at the surface of the object. If they are not equal, the
// property change is somewhere deeper in the object graph.
newValue.addEventListener(
PropertyChangeEvent.PROPERTY_CHANGE,
dispatchEvent);
// need to stop listening for events from the old property
oldValue.removeEventListener(
PropertyChangeEvent.PROPERTY_CHANGE,
dispatchEvent);
_myProperty = newValue;
// now notify anyone that is listening
if (dispatcher.hasEventListener(PropertyChangeEvent.PROPERTY_CHANGE))
{
var event:PropertyChangeEvent =
PropertyChangeEvent.createUpdateEvent(
this,
"myProperty",
newValue,
oldValue);
dispatchEvent(event);
}
}
코멘트가 추가되었을 경우, 메일로 받기. | 코멘트 리포트
현재의 페이지: http://flexdocs.kr/docs/flex2/langref/mx/core/IPropertyChangeNotifier.html