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]
1  Announcements and General Discussion / General Discussion / How to solve this thingy in an elegant way? on: August 23, 2009, 03:28:20
I'm building a skinnable application. Before the application loads the skins, styles and fonts need to be loaded. I decided that three proxies, one for the decals, one for the CSS and one for the fonts would be an ok idea. I integrated that with the startup utility as, well, the fonts proxy needs to know what fonts are used in the CSS, and using it appeared to be a good idea.

Now here comes the problem however. The very idea of skinning is that I can throw a new LabelComponent("Label #AboutUs") and it works. However that means that a view component needs to keep a reference to the proxy in order to actually get and apply the CSS formatting. Worse, whenever I need any graphic at all, be it a simple button or a logo, I need to get it from my DecalProxy. This led to a situation where most of the viewcomponents are using the proxy to get the concrete data they need.

Now I realize this isn't a very elegant solution. On a scale from Pretty to Unelegant it's probably somewhere around "Beat with an ugly stick".

What's the best course to remedy this? Should I create an interface for the proxies and pass them as constructor arguments or maybe a static var? Should I remove the skinning functionality from the components and move it into the mediator? Or should I create a viewcomponent factory?
2  Announcements and General Discussion / Getting Started / Conditional macrocommand execution 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?
Pages: [1]