Imagine you have an application that is like a contact address book. The
user requests the information for a new contact and the database responds.
Now you might want to have several items listening to a change in what
contact has been selected - for example a text field that displays the
name of the contact, a movieclip that displays the picture of the contact,
a data grid component that displays the particular contact information
such as address, email and url for that contact.

All will want to listen for an update or change in what contact you are
viewing and therefore, all can subscribe to one event that notifies them
of a change in the information they are displaying.




> If this is an example of the listener object approach:
>
> ----------------------------------------------------------------------------------------
> myObj = new Object();
> myObj.onMouseDown = myFunction;
> function myFunction() {
>       trace("tracing something");
> }
> Mouse.addListener(myObj);
> ----------------------------------------------------------------------------------------
>
> ... and the listener object approach is favored over the event handler
> function approach, what would the above code look like if it were
> written  with the event handler function approach.
>
> Where you can use one approach, can you always use the other ? (trying
> to  understand the difference and where to use one instead of the
> other).
>
> Apparently, the main reason the listener object approach is favored is
> because multiple listener objects can receive events from the same
> component/movieclip/etc. Does anyone have an example of this so I can
> see  the advantage in action.
>
> Thanks in advance for any assist,
> Stephen.
>
>
> _______________________________________________
> Flashcoders mailing list
> [email protected]
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders



_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to