PureMVC Architects Lounge

Announcements and General Discussion => Getting Started => Topic started by: hesten on July 12, 2009, 02:03:53



Title: Can view components load images?
Post by: hesten on July 12, 2009, 02:03:53
Hi

This is probably a stupid question, but is a view component allowed to load the external images it needs (using Loader in Flash)?

Regards


Title: Re: Can view components load images?
Post by: Tekool on July 12, 2009, 05:47:31
When I only have to load a unique image I fully load it in a mediator. When it cames to a list of images, I prefer to use a proxy. But sometimes, when the loading is too dependent of the view state (scrolling, complex user interaction), I suppose that to manage all the loading in a well designed mediator is sufficient.


Title: Re: Can view components load images?
Post by: Sammi on July 12, 2009, 06:20:24
It is perfectly fine to have the views load external images.

Most of the time my views are responsible for loading the images it requires, unless the images are required at startup.  Then my InitialAssetsProxy loads them and the view's mediator passes them to the view.

Someone made a simple BulkLoaderProxy recently and shared it here on the forums and I might use that in upcoming projects.

Best,
Sammi


Title: Re: Can view components load images?
Post by: hesten on July 12, 2009, 10:02:13
Tek > Why do you load it in the mediator, I was under the impression that a mediator should do nothing more than mediate?

Sammi > I was thinking about a gallery where a list of images is loaded when the callery is requested. My own perspective is the same as yours, that the view component should be able to load the images it needs - the list from which it gathers information on which images to load on the other hand I have in a Proxy.


Title: Re: Can view components load images?
Post by: Tekool on July 12, 2009, 10:29:09
hesten> I mean to use the mediator to initiate loading, receive complete event and add the image to the display list in the mediated view. You don't need this when the view is able by itself to load the image (when an image component is used in Flex or when you have your own component).


Title: Re: Can view components load images?
Post by: hesten on July 12, 2009, 11:58:09
Oh ok, I get what you're saying now :)