Over 10 years of community discussion and knowledge are maintained here as a read-only archive. New discussions should be taken up in issues on the appropriate projects at https://github.com/PureMVC
|
|
|
Show Posts
|
Pages: [1] 2
|
2
|
PureMVC Manifold / Demos and Utils / Re: AsyncCommand - A PureMVC / AS3 Utility
|
on: October 26, 2012, 08:49:19
|
Thanks Cliff,
I have additional questions about the the implementation in the demo.
This makes sense:
public class ExampleAsyncMacroCommand extends AsyncMacroCommand { /** * Execute the SubCommands. */ override protected function initializeAsyncMacroCommand () : void { addSubCommand( FirstAsyncCommand ); addSubCommand( SecondAsyncCommand ); addSubCommand( ExampleSimpleCommand ); addSubCommand( ThirdAsyncCommand ); addSubCommand( ExampleSimpleCommand ); } }
If FirstAsyncCommand is going to call ProxyA.1. How would I know when to call commandComplete in FirstAsyncCommand if ProxyA.1 is an async remote object call? I think I need to call commandComplete() before the next SubCommand will execute. (is this right?)
This is taken from the demo just as a reference:
public class FirstAsyncCommand extends AsyncCommand { /** * Execute the business logic. * <P> * Starts a timer which calls <code>onTimer</code> when complete. */ override public function execute ( note:INotification ) : void { var timer:Timer = new Timer( 5000, 1 ); timer.addEventListener( TimerEvent.TIMER, onTimer ); var logMessage:String = "STARTING FIRST ASYNC COMMAND..."; sendNotification( ApplicationFacade.LOG_OUTPUT, logMessage ); timer.start(); } /** * Handle Timer event. * <P> * Resets timer and removes listener, sends a notification * with a log message and finally, notifies any * AsyncMacroCommand that may have invoked it that this * AsyncCommand is complete. */ private function onTimer( event:TimerEvent ) : void { var t:Timer = event.currentTarget as Timer; t.reset(); t.removeEventListener( TimerEvent.TIMER, onTimer ); t = null; var logMessage:String = "FIRST ASYNC COMMAND COMPLETE"; sendNotification( ApplicationFacade.LOG_OUTPUT, logMessage ); commandComplete(); } }
Thanks for your help and I am reading through the other method you suggested. Shinan
|
|
|
3
|
PureMVC Manifold / Demos and Utils / Re: AsyncCommand - A PureMVC / AS3 Utility
|
on: October 26, 2012, 06:25:58
|
I hope I'm not beating a dead horse but I am really looking for some guidance here.
I have certain situations where I need to call a certain sequence of Proxy calls (same proxy different methods) and they must be completed in a certain order.
I have it currently implemented like: Mediator A -> Proxy A.1 -> Mediator A-> Proxy A.2 -> Mediator B -> Proxy A.3
I thought there was a better way to do this since following a trail of Notifications doesn't seem right.
Initially it looked like AsyncCommand could help me with something like this but after reading the thread I'm not sure.
I was hoping that the AsyncCommand could help me do something like this: Mediator A -> AsyncCommand
My AsyncCommand would have AsyncSubCommands that would have calls to the ProxyA.1, A.2....
Is this a good use case for the AsyncCommand to help me get rid of the trail (and back and forth between mediator and proxy) of notifications?
TIA Shinan
|
|
|
6
|
PureMVC Manifold / MultiCore Version / One faultEvent handler for all my Proxies
|
on: July 21, 2010, 11:24:22
|
Hi, I am using RemoteObjects in my proxies and I want to use the same FaultEvent handler for all my proxies. Part of the logic for the FaultEvent handler will be sending a notification to the application depending on what the fault is. My question is where should my faultHandler go? In a Mediator? a Command? or a standalone class? If standalone class, how do I call sendNotification from a standalone class?
Thanks In Advance Shinan
|
|
|
8
|
PureMVC Manifold / Standard Version / Question about resetting an application built with PMVC
|
on: October 24, 2008, 06:18:39
|
I have an application that uses deferred instantiation (mediators and proxies are only created when needed). When the user logs out, I would like a way to 'reset' the application into its initial state. Right now I am reloading the page that the application is loaded from but I am not sure what the PMVC approach might be.
Any help is appreciated. Thanks.
|
|
|
9
|
Announcements and General Discussion / Architecture / Re: Appropriate use of MXML WebService
|
on: July 07, 2008, 12:55:09
|
I am not sure if this is the _correct_ way but in AS3 you are probably using:
import mx.rpc.remoting.RemoteObject;
That does not have the showBusyCursor attribute.
Instead use:
import mx.rpc.remoting.mxml.RemoteObject;
And you will be able to do something like:
configurationService = new RemoteObject(); configurationService.showBusyCursor = true; ...
HTH, Shinan
|
|
|
14
|
Announcements and General Discussion / Getting Started / Re: Question about startup
|
on: June 03, 2008, 06:23:33
|
Got it!
Absolutely Brilliant Cliff. Thank you for the solution. You Rock!
P.S. It took me about a week to get my head around pureMVC. Granted it may take a little more time up front to get my application setup. However, I can already tell that as soon as my basic application structure is setup the development will fly.
Thanks alot!
|
|
|
15
|
Announcements and General Discussion / Getting Started / Re: Question about startup
|
on: June 02, 2008, 12:43:37
|
No those are valid questions and yes to all. Let me restate my question correctly.
checkSession does execute. The problem is that for some reason the first time checkSession runs loginVO is null. If I run checkSession twice, the second time it returns the loginVO which is the right behavior.
In loginMediator:
private function checkSession():void { loginProxy = facade.retrieveProxy( LoginProxy.NAME ) as LoginProxy; Alert.show(ObjectUtil.toString(loginProxy.loggedIn),"In checkSession"); if (loginProxy.loggedIn) { sendNotification( ApplicationFacade.VIEW_FBAPP ); sendNotification ( ApplicationFacade.UPDATE_WELCOME,loginProxy.loginVO ); } else { sendNotification( ApplicationFacade.VIEW_LOGIN ); } }
In loginProxy:
public function get loggedIn():Boolean { loginService.checkUserSession.addEventListener( ResultEvent.RESULT, onCheckUserSessionResult ); loginService.checkUserSession.send() Alert.show(ObjectUtil.toString(loginVO),"In loggedIn"); return ( loginVO != null ); } // To log out, simply clear the LoginVO and log out from the HTTP session for extra security public function logout( ) : void { setData(null); loginService.userLogout.send(); } private function onCheckUserSessionResult( event:ResultEvent ):void { //Alert.show(ObjectUtil.toString(event.result),"In onCheckUserSessionResult"); if (!event.result) { setData(null) } else { setData(event.result as LoginVO) } } Thanks!
|
|
|
|
|
|