Over 10 years of community discussion and knowledge are maintained here as a read-only archive.
[b]Project Proxy[/b] // setting the name public static const NAME:String = "ProjectProxy"; // set the proxy's data to be retrieved setData( projects ); // send the project's loaded notification. mediators can get its data from the facade using the NAME passed in the body sendNotification( ApplicationFacade.PROJECTS_LOADED, ProjectProxy.NAME ); [b]LoginMediator[/b] case ApplicationFacade.PROJECTS_LOADED: projectProxy = facade.retrieveProxy( body as String ) as ProjectProxy; loginForm.domainSource = ( projectProxy.getData() as Array ); break;
Sounds as if the Proxy isn't registered. By the way, you should define the notification constant on the Proxy so that the Proxy isn't bound to the ApplicationFacade. The Proxy can then be reused in other applications without relying on a constant that it depends on to be defined elsewhere.-=Cliff>
public class LoadResourcesCommand extends SimpleCommand implements ICommand { private var monitor:LoadupMonitorProxy; public override function execute( note:INotification ):void { facade.registerProxy( new LoadupMonitorProxy() ); this.monitor = facade.retrieveProxy( LoadupMonitorProxy.NAME ) as LoadupMonitorProxy; var projectProxy:ILoadupProxy = new ProjectProxy(); facade.registerProxy( projectProxy ); makeAndRegisterLoadupResource( ProjectProxy.NAME, projectProxy); this.monitor.loadResources(); } private function makeAndRegisterLoadupResource( proxyName :String, appResourceProxy:ILoadupProxy ):LoadupResourceProxy { var r:LoadupResourceProxy = new LoadupResourceProxy( proxyName, appResourceProxy ); facade.registerProxy( r ); monitor.addResource( r ); return r; } }
public function loaded( asToken:Object=null ):void { var projects:Array = []; for each ( var item:Object in asToken.result ) { projects.push( { label: item.domain, data: item.domain } ); sendNotification( ApplicationFacade.LOADING_STEP, asToken.result.length / projects.length * 100 ); } // set the proxy's data to be retrieved from interested mediators setData( projects ); // send the project's loaded notification. mediators can get its data from the facade using the NAME passed in the body sendNotification( ProjectProxy.PROJECTS_RETRIEVED, ProjectProxy.NAME ); }
case ProjectProxy.PROJECTS_RETRIEVED: var projects:Array = facade.retrieveProxy( body as String ).getData() as Array; loginForm.domainSource = ( projects ); break;
var rCus :LoadupResourceProxy = makeAndRegisterLoadupResource( CustomerProxy.SRNAME, cusPx );
That would be my suggestion.-=Cliff>
public class LoadingCompleteCommand extends CustomSimpleCommand { public override function execute(note:INotification):void { //if we are in the starting command we can move out of the state into the configuring commadn if (this.stateMachine.currentState.name == StateNames.STARTING) { this.sendNotification(StateMachine.ACTION, null, StateNames.CONFIGURING_PRODUCT); } } }