I notice in some examples, some implements interface and some don't (i.e. in FlickerGallery demo it only declares "public class ApplicationFacade extends Facade", while in HelloWorld demo is declares "public class ApplicationFacade extends Facade implements IFacade" ... I know the best practice is to program to Interface .. or is not declaring "implement InterfaceName" just a lazy way to do it even though it will work?
Basically, this simple application has two frames. 1 for preloading and the 2nd frame for the application main proper (a typical setup i believe). There’s a component in the library (a custom one, named ExampleComponent) that is being loaded by a Mediator, and this Mediator (ExampleComponentMediator) communicates with this custom component and freely notifies the facade. The Images and Tag (Character name) is from an XML file, utilizing “Proxy” pattern on PureMVC Framework.
// Notification name constants public static var STARTUP:String = "startup"; private static var instance; /** * Singleton ApplicationFacade factory method */ public static function getInstance():ApplicationFacade { if ( instance == null ) instance = new ApplicationFacade(); return ApplicationFacade(instance); }
public function startup( app:CamScript ) : Void { notifyObservers( new Notification( STARTUP, app ) ); } /** * Register Commands with the Controller */ function initializeController():Void { super.initializeController(); // registerCommand( STARTUP, StartupCommand ); } } some Question(s):
1. return ApplicationFacade(instance); // Did i type cast this correct? 2. There is no method with the name 'notifyObservers'.