Futurescale, Inc. PureMVC Home

The PureMVC Framework Code at the Speed of Thought


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

* | |

  Show Posts
Pages: [1] 2
1  PureMVC Manifold / Demos and Utils / Re: AsyncCommand - A PureMVC / AS3 Utility on: October 29, 2012, 05:24:22
Thanks Cliff,
I saw what you did in the example and it makes sense. Thanks! That is the methodology I am going to use.
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
4  Announcements and General Discussion / Architecture / Share Values in all Models? on: October 24, 2011, 09:22:13
I want to share a value (global) between all my Models. What is the most sound way to do this?

I can set these values when the application loads but where would the best place to put these values so that the Models would have access to them?

TIA,
Shinan
5  PureMVC Manifold / MultiCore Version / Re: One faultEvent handler for all my Proxies on: July 22, 2010, 08:46:54
Thanks Cliff,

Sorry, after I read your response it was painfully obvious I overlooked the most straightforward solution.

Again. Thanks for your help & patience. After I try it, I will report back.
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




7  PureMVC Manifold / Standard Version / Re: Question about resetting an application built with PMVC on: October 24, 2008, 06:30:08
Thanks for the reply.

I was actually working on this yesterday and just realized the stupid mistake I was making. I was removing my mediators and leaving the proxies. Crap, I was wondering why the data was still stale. Duh...amazing what a night of good sleep will do for you.

Thanks.
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
10  Announcements and General Discussion / Architecture / Re: What is the purpose of the Observer? on: June 19, 2008, 12:44:24
Thanks for the explaination. BTW, PureMVC has helped me alot building my Flex App. Thank You!
11  Announcements and General Discussion / Architecture / What is the purpose of the Observer? on: June 13, 2008, 08:19:34
Now that I am waist deep in my app I have a better understanding of PureMVC (mediators, proxies, notifications, etc...)

But where do observers fit into the big picture?

Anyone can provide insight?

TIA,
Shinan
12  Announcements and General Discussion / Getting Started / Re: General Application Design Question on: June 04, 2008, 05:43:34
Thanks!
13  Announcements and General Discussion / Getting Started / General Application Design Question on: June 03, 2008, 01:39:05
If I am logging in a user as loginVO. I will have many proxies and mediators (other than the loginProxy and loginMediator) that will need access to attributes of that user. What is the pureMVC way to store that user and retrieve it when needed?

TIA,
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!
Pages: [1] 2