Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
98 Building user interaction else { dispatchEvent( new LoginEvent(LoginEvent.LOGINFAILED, time) ); } } Assuming events are already implemented, if we compile now we get a compilation error: "Call to a possibly unde- fined method dispatchEvent."This is due to the fact that an ActionScript class cannot dispatch an event per se.The pre- vious example worked because we were in a <Application> context, which is part of a hierarchy of classes that either extend the EventDispatcher class or implement the IEventDispatcher interface. In our case it is enough to make the Authenticator class to extend EventDispatcher to be allowed to call the dispatchEvent method. As you can see there is no more reference to UI elements-- Authenticator justcallsaURLanddispatchestheevent.Wheneveryouhap- pen to meet a situation like this you are in front of well-archi-