<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <META http-equiv="Content-Type" content="text/html; charset=UTF-8"> <link rel="stylesheet" href="../../../../style.css" type="text/css" media="screen"> <link rel="stylesheet" href="../../../../print.css" type="text/css" media="print"> <meta content="IObserver,org.puremvc.as3.interfaces.IObserver,compareNotifyContext,notifyObserver,setNotifyContext,setNotifyMethod" name="keywords"> <title>org.puremvc.as3.interfaces.IObserver</title> </head> <body> <script type="text/javascript" language="javascript" src="../../../../asdoc.js"></script><script type="text/javascript" language="javascript" src="../../../../cookies.js"></script><script type="text/javascript" language="javascript"> <!-- asdocTitle = 'IObserver - API Documentation'; var baseRef = '../../../../'; window.onload = configPage; --></script> <table style="display:none" id="titleTable" cellspacing="0" cellpadding="0" class="titleTable"> <tr> <td align="left" class="titleTableTitle">PureMVC AS3 Framework - [Standard Version]</td><td align="right" class="titleTableTopNav"><a onclick="loadClassListFrame('../../../../all-classes.html')" href="../../../../package-summary.html">All Packages</a> | <a onclick="loadClassListFrame('../../../../all-classes.html')" href="../../../../class-summary.html">All Classes</a> | <a onclick="loadClassListFrame('../../../../index-list.html')" href="../../../../all-index-A.html">Index</a> | <a href="../../../../index.html?org/puremvc/as3/interfaces/IObserver.html&org/puremvc/as3/interfaces/class-list.html" id="framesLink1">Frames</a><a onclick="parent.location=document.location" href="" style="display:none" id="noFramesLink1">No Frames</a></td><td rowspan="3" align="right" class="titleTableLogo"><img alt="Adobe Logo" title="Adobe Logo" class="logoImage" src="../../../../images/logo.jpg"></td> </tr> <tr class="titleTableRow2"> <td align="left" id="subTitle" class="titleTableSubTitle">Interface IObserver</td><td align="right" id="subNav" class="titleTableSubNav"><a href="#methodSummary">Methods</a></td> </tr> <tr class="titleTableRow3"> <td colspan="2"> </td> </tr> </table> <script type="text/javascript" language="javascript"> <!-- if (!isEclipse() || window.name != ECLIPSE_FRAME_NAME) {titleBar_setSubTitle("Interface IObserver"); titleBar_setSubNav(false,false,false,false,false,false,true,false,false,false,false,false,false,false);} --></script> <div class="MainContent"> <table cellspacing="0" cellpadding="0" class="classHeaderTable"> <tr> <td class="classHeaderTableLabel">Package</td><td><a onclick="javascript:loadClassListFrame('class-list.html')" href="package-detail.html">org.puremvc.as3.interfaces</a></td> </tr> <tr> <td class="classHeaderTableLabel">Interface</td><td class="classSignature">public interface IObserver</td> </tr> <tr> <td class="classHeaderTableLabel">Implementors</td><td><a href="../patterns/observer/Observer.html">Observer</a></td> </tr> </table> <p></p> The interface definition for a PureMVC Observer. <P> In PureMVC, <code>IObserver</code> implementors assume these responsibilities: <UL> <LI>Encapsulate the notification (callback) method of the interested object.</LI> <LI>Encapsulate the notification context (this) of the interested object.</LI> <LI>Provide methods for setting the interested object' notification method and context.</LI> <LI>Provide a method for notifying the interested object.</LI> </UL> <P> PureMVC does not rely upon underlying event models such as the one provided with Flash, and ActionScript 3 does not have an inherent event model.</P> <P> The Observer Pattern as implemented within PureMVC exists to support event driven communication between the application and the actors of the MVC triad.</P> <P> An Observer is an object that encapsulates information about an interested object with a notification method that should be called when an </code>INotification</code> is broadcast. The Observer then acts as a proxy for notifying the interested object. <P> Observers can receive <code>Notification</code>s by having their <code>notifyObserver</code> method invoked, passing in an object implementing the <code>INotification</code> interface, such as a subclass of <code>Notification</code>.</P> <p></p> <p> <span class="classHeaderTableLabel">See also</span> </p> <div class="seeAlso"> <a href="../interfaces/IView.html" target="">IView</a> <br> <a href="../interfaces/INotification.html" target="">INotification</a> </div> <br> <hr> </div> <a name="methodSummary"></a> <div class="summarySection"> <div class="summaryTableTitle">Public Methods</div> <table id="summaryTableMethod" class="summaryTable " cellpadding="3" cellspacing="0"> <tr> <th> </th><th colspan="2">Method</th><th class="summaryTableOwnerCol">Defined by</th> </tr> <tr class=""> <td class="summaryTablePaddingCol"> </td><td class="summaryTableInheritanceCol"> </td><td class="summaryTableSignatureCol"> <div class="summarySignature"> <a class="signatureLink" href="#compareNotifyContext()">compareNotifyContext</a>(object:Object):Boolean</div> <div class="summaryTableDescription"> Compare the given object to the notificaiton context object.</div> </td><td class="summaryTableOwnerCol">IObserver</td> </tr> <tr class=""> <td class="summaryTablePaddingCol"> </td><td class="summaryTableInheritanceCol"> </td><td class="summaryTableSignatureCol"> <div class="summarySignature"> <a class="signatureLink" href="#notifyObserver()">notifyObserver</a>(notification:<a href="INotification.html">INotification</a>):void</div> <div class="summaryTableDescription"> Notify the interested object.</div> </td><td class="summaryTableOwnerCol">IObserver</td> </tr> <tr class=""> <td class="summaryTablePaddingCol"> </td><td class="summaryTableInheritanceCol"> </td><td class="summaryTableSignatureCol"> <div class="summarySignature"> <a class="signatureLink" href="#setNotifyContext()">setNotifyContext</a>(notifyContext:Object):void</div> <div class="summaryTableDescription"> Set the notification context.</div> </td><td class="summaryTableOwnerCol">IObserver</td> </tr> <tr class=""> <td class="summaryTablePaddingCol"> </td><td class="summaryTableInheritanceCol"> </td><td class="summaryTableSignatureCol"> <div class="summarySignature"> <a class="signatureLink" href="#setNotifyMethod()">setNotifyMethod</a>(notifyMethod:Function):void</div> <div class="summaryTableDescription"> Set the notification method.</div> </td><td class="summaryTableOwnerCol">IObserver</td> </tr> </table> </div> <script type="text/javascript" language="javascript"> <!-- showHideInherited(); --></script> <div class="MainContent"> <a name="methodDetail"></a> <div class="detailSectionHeader">Method detail</div> <a name="compareNotifyContext()"></a> <table cellspacing="0" cellpadding="0" class="detailHeader"> <tr> <td class="detailHeaderName">compareNotifyContext</td><td class="detailHeaderParens">()</td><td class="detailHeaderType">method</td> </tr> </table> <div class="detailBody"> <code>public function compareNotifyContext(object:Object):Boolean</code><p> Compare the given object to the notificaiton context object. </p><span class="label">Parameters</span> <table border="0" cellspacing="0" cellpadding="0"> <tr> <td width="20px"></td><td><code><span class="label">object</span>:Object</code> — the object to compare. </td> </tr> </table> <p></p> <span class="label">Returns</span> <table border="0" cellspacing="0" cellpadding="0"> <tr> <td width="20"></td><td><code>Boolean</code> — boolean indicating if the notification context and the object are the same. </td> </tr> </table> </div> <a name="notifyObserver()"></a> <table cellspacing="0" cellpadding="0" class="detailHeader"> <tr> <td class="detailHeaderName">notifyObserver</td><td class="detailHeaderParens">()</td><td class="detailHeaderType">method</td><td class="detailHeaderRule"> </td> </tr> </table> <div class="detailBody"> <code>public function notifyObserver(notification:<a href="INotification.html">INotification</a>):void</code><p> Notify the interested object. </p><span class="label">Parameters</span> <table border="0" cellspacing="0" cellpadding="0"> <tr> <td width="20px"></td><td><code><span class="label">notification</span>:<a href="INotification.html">INotification</a></code> — the <code>INotification</code> to pass to the interested object's notification method </td> </tr> </table> </div> <a name="setNotifyContext()"></a> <table cellspacing="0" cellpadding="0" class="detailHeader"> <tr> <td class="detailHeaderName">setNotifyContext</td><td class="detailHeaderParens">()</td><td class="detailHeaderType">method</td><td class="detailHeaderRule"> </td> </tr> </table> <div class="detailBody"> <code>public function setNotifyContext(notifyContext:Object):void</code><p> Set the notification context. </p><span class="label">Parameters</span> <table border="0" cellspacing="0" cellpadding="0"> <tr> <td width="20px"></td><td><code><span class="label">notifyContext</span>:Object</code> — the notification context (this) of the interested object </td> </tr> </table> </div> <a name="setNotifyMethod()"></a> <table cellspacing="0" cellpadding="0" class="detailHeader"> <tr> <td class="detailHeaderName">setNotifyMethod</td><td class="detailHeaderParens">()</td><td class="detailHeaderType">method</td><td class="detailHeaderRule"> </td> </tr> </table> <div class="detailBody"> <code>public function setNotifyMethod(notifyMethod:Function):void</code><p> Set the notification method. <P> The notification method should take one parameter of type <code>INotification</code></P> </p><span class="label">Parameters</span> <table border="0" cellspacing="0" cellpadding="0"> <tr> <td width="20px"></td><td><code><span class="label">notifyMethod</span>:Function</code> — the notification (callback) method of the interested object </td> </tr> </table> </div> <br> <br> <hr> <br> <p></p> <center class="copyright"> <footer> </footer> </center> </div> </body> </html> <!-- -->