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]
Author Topic: Where should visual theme assets go?  (Read 11321 times)
Posts: 1

View Profile Email
« on: December 23, 2007, 12:50:29 »

Hi everyone,

first of all - thank you for this great framework, and the lively discussion.

I'm new to PureMVC and currently reworking a flash app to benefit from it. My app uses different visual themes that can be swapped at runtime. Theme assets include CSS files, fonts and images which are also loaded at runtime when needed. Any number of view components might use (share) them... I feel the best way to handle these assets would be by loading and caching them with remote proxies.
Now, although this sounds clearly view related, i'm wondering wether my view mediators should take care of it -- or if the model would be a better place. After all, these theme assets are persistent data and not coupled to any particular view components.


One other thing regarding these remote proxies: is it ok (or perhaps common) to mix Proxy with Facade? I'd want to do something like this:
1. proxy is asked to load all assets for a specific theme
2. proxy delegates to 3 subproxies, each responsible for loading and caching different asset types (css, font, img)
3. subproxies send onLoadComplete events to proxy
4. proxy notifies the app about the theme being ready to use
5. views can now retrieve assets through the proxy

Well, maybe this isn't a proxy after all, but rather a facade in front of 3 proxies? Would it still be registered with the model?

Thanks a lot for any thoughts on this.
Joel Hooks
Courseware Beta
Sr. Member
Posts: 146

baby steps

 - 46288188  - passport@provinsal.com  - joeltuff
View Profile WWW Email
« Reply #1 on: December 25, 2007, 01:20:59 »

There is a really tight asset loading example in the ApplicationSkeleton example posted here. The example is Flex, but I believe the proxy setup would carry over directly to Flash.

http://joelhooks.com - my ramblings about developing with actionscript and python using pureMVC and django respectively.
Full Member
Posts: 26

View Profile Email
« Reply #2 on: December 27, 2007, 02:57:08 »

I'm using a Command to govern the loading process of assets.

1. I've registered several Commands to load assets with the ApplicationFacade, like LoadMovieCommand.
2. The viewcomponent broadcasts an event to its Mediator, like onChange.
3. The Mediator sends a Notification which invokes LoadMovieCommand
4. LoadMovieCommand retrieves a remote Proxy to load a swf
5. When loaded, the remote Proxy sends a Notification which invokes a Command - like AddViewsCommand.
6. AddViewsCommand evaluates what has been loaded (for instance by looking at the type of the Notification) and based on the result, sends a Notification to invoke another Command like LoadCSSCommand -> step 5 (you can also sequence the loading of several swf's this way).
7. AddViewsCommand decides if all assets are loaded and sends a Notification using the body and optionally the type of the Notification to pass any data to the Mediator.
Pages: [1]