PureMVC Architects Lounge

Announcements and General Discussion => Architecture => Topic started by: Sammi on October 30, 2008, 09:34:02



Title: Commands calling mediators/proxies in timed sequence
Post by: Sammi on October 30, 2008, 09:34:02
Hi,

I have a command that runs when I want my application to return to idle mode ( IdleTimeoutCommand ). This command tells the views to transition to their idle state. 

I want a simple way of controlling - and timing - how the view go to their idle state.  For an example I want the menu to go first, then the background graphics, and so on.

Am I allowed to have the command call the view for an example with TweenLite.delayedCall()?

So call view A after 0.5 seconds, B after 0.8 seconds and so on?

Could it happen that the command is removed from memory before it gets to call the view?

Confusing???

Best,
Sammi


Title: Re: Commands calling mediators/proxies in timed sequence
Post by: marek on November 07, 2008, 07:36:35
Am I allowed to have the command call the view for an example with TweenLite.delayedCall()?
for sure command shouldn't call the view but just send notification. Observer will respond with view right action inside the view. TweenLite can be used - that is not a problem even with delayedCall however I do believe that all transition functionality should be stored within the View. Mediators react for received notifications that can carry a object contains transition sequence. That is my solution.

If you want to take them down one by one... hmm....
you might create a function that will be called everytime one of them has been removed or tweened. You can fire it using
:
TweenLite.delayedCall(delay:Number, onComplete:Function, onCompleteParams:Array):TweenLite
Function will check if there any objects left - all available in the conatainer or within array that can store it. If yes will take another from the stage or list you predefined and perform expected action. My feeling is to keep it simple but not too much. ;)


Title: Re: Commands calling mediators/proxies in timed sequence
Post by: Sammi on November 10, 2008, 03:22:31
Thank you for your response.

I always to this ;)  I tend to call the mediators the "view" because they belong to the view.  But people obviously often misunderstand and think I am talking about the view components.

But I still think you are right.  Using notifications are cleaner even if they mean more code.

Best,
Sammi