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

Pages: [1]
Print
Author Topic: Conditional macrocommand execution  (Read 6267 times)
archont
Newbie
*
Posts: 3


View Profile Email
« on: March 14, 2009, 11:10:48 »

Commands are there to orchestrate complex tasks. Well, that's pretty clear.

My application uses a NavigationProxy to respond to navigation requests. A special SetupNavigationCommand gives the particular mediators' buttons IDs, and gives the proxy http address (ie. #/aboutus/ ) and contentmediators. When a user clicks a button the proxy is called with the button's ID. SWFaddress changes the address to the one associated with the ID and a semi-complex cascade of events occur that animate and replace the previous content block, a ContentMediator with a new one.

Now I wanted to make the inner implementation of the content an internal thing. Some content blocks may be static ones that have the assets embeded in the SWF. Some may be wrappers for external SWF files. Other content blocks may load images or whole galleries. In short: the loading time varies.

And so I have one NavigationCommand that creates the new content class and starts loading it, fades out the old content, fires a resize animation, some wacky flashes and whatnot. All of it is run in an asynccommand. The whole NavigationCommand is in fact a mix of synchronous (logic) and asynchronous (animation, content loading ect) commands. By the time the animation finished the data of the new content may have already loaded.. or not. The content may not need any loading at all - only the ContentMediator knows.

Thing is, I want commands to do simple and reusable things. Individual commands do a specific part of functionality (such as animating between two content mediators - for example, an About section and a Loader, or between a Loader and a Gallery section.. or between a Gallery section and a no-loader-required Newsletter panel) - and I want to include conditional logic inside the macrocommand.

For example, I want to check if the current panel requires loading. If so, I load a Loader. If not, I load the  actual panel.

Is it possible to embed conditional logic inside of macroevents?
Logged
Pages: [1]
Print