Over 10 years of community discussion and knowledge are maintained here as a read-only archive.
<fsm initial={ApplicationFacade.STARTING}><state name={ApplicationFacade.STARTING}><transition action={ApplicationFacade.ACTION_STARTUP} target={ApplicationFacade.LOAD_PROJECTS}/><transition action={ApplicationFacade.STARTUP_FAILED} target={ApplicationFacade.STARTUP_FAILED}/></state><state name={ApplicationFacade.LOAD_PROJECTS}><transition action={ApplicationFacade.LOAD_PROJECTS} target={ApplicationFacade.PROJECTS_LOADED}/><transition action={ApplicationFacade.PROJECTS_LOADING_FAILED} target={ApplicationFacade.PROJECTS_LOADING_FAILING}/></state></fsm>;Thank you.
Hi,If you are in a StateMachine logic for the main application, you could use StateMachine in all other "components" or Modules... Each Core can have its own StateMachine (you have to use the multicore package for that).The way you use StateMachine seems not to be the right way.. You should have one State Machine for your main app with two views LOGIN and POPULATE COMBO.And in each view, other StateMachines or Notifications handlers to swap between components view. For your FSM, i think the one you provide would be for the Project loading module... not for the main one.. and don't forget to define the target state in your FSM :ApplicationFacade.STARTUP_FAILED,ApplicationFacade.PROJECTS_LOADED and ApplicationFacade.PROJECTS_LOADING_FAILINGregards:::Poly:::
public class ProjectProxy extends EntityProxy implements ILoadupProxy{ // send LoginAttempt as proxy data public function ProjectProxy() { super( ProjectProxy.NAME ); } // notification name constants public static const NAME:String = "ProjectProxy"; public static const SRNAME:String = 'ProjectSRProxy'; public static const PROJECTS_RETRIEVED:String = NAME+'/notes/projects_retrieved'; public static const PROJECTS_RETRIEVAL_FAILED:String = NAME+'/notes/projects_retrieval_failed'; // project service private var projectService:RemoteObject; private var tryCount:int = 0; // configure the proxy when registered public override function onRegister():void { // configure the remote object projectService = new RemoteObject("GenericDestination"); projectService.source = "ProjectService"; // is this ok? Had do listen for the remote call. I thought this would be inherited behaviour projectService.getOperation("getProjects").addEventListener( ResultEvent.RESULT, loaded ); projectService.getOperation("getProjects").addEventListener( FaultEvent.FAULT, failed );} // call the remote object servicepublic function load():void { tryCount++; sendNotification( ApplicationFacade.PROJECTS_LOADING, NAME, SRNAME ); projectService.getProjects();} // remote procedure is successfullpublic 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 } ); } setData( projects ); // not sure what this is for sendNotification( ApplicationFacade.PROJECTS_LOADED, NAME, SRNAME ); // this is how I am sending the retrieved data. sendNotification( ProjectProxy.PROJECTS_RETRIEVED, data ); } // remote login procedure is successfullpublic function failed( asToken:Object=null ):void { sendNotification( PROJECTS_RETRIEVAL_FAILED ); }
Just to clarify about 'loaded' notifications in the Loadup utility. The release notes in version.txt state: On loaded and failed notifications sent by the client app, if the monitor proxyName is not the default name, the notification type MUST BE the monitor proxyName.So, type should be empty unless the LoadupMonitorProxy has been given a custom name.This business of SRNAME may have arisen from the LoadupAsOrdered demo, where there are code instances like sendLoadedNotification( blah_LOADED, NAME, SRNAME ). This 'sendLoadedNotification' method is local to the demo; it is not part of the Loadup API.----Philip
Sent ApplicationFacade/action/startupSent ApplicationFacade/note/startedSent ApplicationFacade/action/showSplashScreenSent ApplicationFacade/action/loadResourcesSent ApplicationFacade/note/loading_projectsError: null: Unknown ILoadupProxy in loaded/failed notification, not known in LoadupMonitorProxy instance named :LoadupMonitorProxy at org.puremvc.as3.multicore.utilities.loadup.model::LoadupMonitorProxy/resolveAppProxyNameElseError()[C:\My Documents\Flex Builder 3\PureMVC\Utility_AS3_Loadup_2_0\multicore\org\puremvc\as3\multicore\utilities\loadup\model\LoadupMonitorProxy.as:485] at org.puremvc.as3.multicore.utilities.loadup.model::LoadupMonitorProxy/resourceLoaded()[C:\My Documents\Flex Builder 3\PureMVC\Utility_AS3_Loadup_2_0\multicore\org\puremvc\as3\multicore\utilities\loadup\model\LoadupMonitorProxy.as:448] at org.puremvc.as3.multicore.utilities.loadup.controller::LoadupResourceLoadedCommand/execute()[C:\My Documents\Flex Builder 3\PureMVC\Utility_AS3_Loadup_2_0\multicore\org\puremvc\as3\multicore\utilities\loadup\controller\LoadupResourceLoadedCommand.as:46] at org.puremvc.as3.multicore.core::Controller/executSent ApplicationFacade/note/projects_loaded
ApplicationFacade registerResourceLoadedCommand( PROJECTS_LOADED ); registerResourceFailedCommand( PROJECTS_LOADING_FAILED );ProjectProxy // remote login procedure is successfull 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 } ); } setData( projects ); sendNotification( ApplicationFacade.PROJECTS_LOADED, data ); }
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 ); var rProjectPx:LoadupResourceProxy = 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; } }
ProjectProxy // remote login procedure is successfull 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 } ); } setData( projects ); sendNotification( ApplicationFacade.PROJECTS_LOADED, ProjectProxy.NAME ); sendNotification( ProjectProxy.PROJECTS_RETRIEVED, data ); }ApplicationFacadecase ApplicationFacade.PROJECTS_LOADED: app.appView.selectedIndex = 2;break;LoginMediatorcase ProjectProxy.PROJECTS_RETRIEVED: loginForm.projectSource = ( body as Array );break;