PureMVC Architects Lounge

PureMVC Manifold => Demos and Utils => Topic started by: puremvc on August 16, 2009, 07:12:04



Title: Loadup for Assets - A PureMVC AS3 / Flex / Loadup Utility Demo
Post by: puremvc on August 16, 2009, 07:12:04
This demo illustrates the use of the PureMVC framework, the Loadup Utility, and its Asset management classes to load display assets.

The demo has historically been located here: http://trac.puremvc.org/Demo_AS3_Flex_LoadupForAssets
The project has been moved here: https://github.com/PureMVC/puremvc-as3-demo-flex-loadupforassets/wiki

The author is Philip Sexton.

NOTE: This project was formerly known as StartupForAssets, and was renamed when StartupManager was renamed Loadup, to dispel the notion that the utility it was only usable at startup time.

The previous thread is here: http://forums.puremvc.org/index.php?topic=716.0


Title: Re: Loadup for Assets - A PureMVC AS3 / Flex / Loadup Utility Demo
Post by: philipSe on August 19, 2009, 04:37:46
There was a glitch in the released version as regards the live demo link; load of one of the assets was failing due to an error in the asset filename. This was clearly reported in the messages text area.  The filename has been adjusted and the file is now loading.
----Philip


Title: Re: Loadup for Assets - A PureMVC AS3 / Flex / Loadup Utility Demo
Post by: kouri on November 11, 2009, 02:47:45
Hello all !

I must admit that this loadup lib is pretty hard to master. :P

Here's my question of the day related to LoadupForAssets demo:

In case I don't want assets to be displayed into an UIcontainer (jpeg here but could be xml for example) so I can get rid of the now useless GroupOfAssets.mxml. Right ?

Then, will I need to convert GroupOfAssetsMediator that hosts important methods as doHandleNotification() or loadingInstructions() into a Proxy  ?

Thanx for your help and please don't refer me to LoadupAsOrdered example as it is more a simulator than a demo.



Title: Re: Loadup for Assets - A PureMVC AS3 / Flex / Loadup Utility Demo
Post by: philipSe on November 12, 2009, 05:02:19
In addition to dropping GroupOfAssets.mxml, I think you would drop several other classes, including GroupOfAssetsMediator and LoadAssetGroupCommand and LoadAssetGroupInstructions.  I hope I'm not missing something.

Let me say some general things, by way of trying to be helpful, even if you know it all already
  • The basic or core Loadup utility offers functionality that provides nothing special for assets; the loadup as ordered demo (lao) is intended to demonstrate this basic functionality
  • Loadup also includes an asset loader suite of classes, to make it easier to use Loadup when loading assets; these asset loader classes act as a client of the basic utility; they interact with the basic functionality
  • the loadup for assets demo (lfa) is intended to demonstrate how to use the asset loader classes; lfa uses a subset of the basic Loadup functionality (not the typical use), and it has the complication of also using the asset loader classes
  • hence, lfa is not the best way to learn the basic Loadup functionality, but it is good if you just want to load assets
  • the lao demo wants to demonstrate the basic functionality, with asynchronous retrieval of resources being a key requirement; it avoids the baggage of actual retrieval, such as database access, by simulating the asynchronous retrieval
  • these demos are intended to exercise and illustrate the utility; they are not primarily intended to be templates for real application solutions; the lao demo probably does not have much code that could be directly reused; the lfa demo is probably much better as regards sections of code that could be directly reused.
----Philip


Title: Re: Loadup for Assets - A PureMVC AS3 / Flex / Loadup Utility Demo
Post by: philipSe on November 12, 2009, 06:54:45
And let me add that, to master the Loadup utility, in addition to the demos, it is important to refer to the API Docs
http://darkstar.puremvc.org/content_header.html?url=http://puremvc.org/pages/docs/AS3/Utility_AS3_Loadup/asdoc/&desc=PureMVC%20API%20Docs:%20Loadup%20Utility%20for%20AS3 (http://darkstar.puremvc.org/content_header.html?url=http://puremvc.org/pages/docs/AS3/Utility_AS3_Loadup/asdoc/&desc=PureMVC%20API%20Docs:%20Loadup%20Utility%20for%20AS3)

For example, the docs with the LoadupMonitorProxy class.
----Philip


Title: Re: Loadup for Assets - A PureMVC AS3 / Flex / Loadup Utility Demo
Post by: kouri on November 12, 2009, 11:06:21
Philip,

Fist of all, thank you for your contribution and your time.
... it is important to refer to the API Docs... For example, the docs with the LoadupMonitorProxy class.

I could not miss the API page about LoadupMonitorProxy that I fully translated http://www.daigleetcie.com/loadup/LoadupMonitorProxy.pdf (http://www.daigleetcie.com/loadup/LoadupMonitorProxy.pdf) (I am about to recitate it like the rosary  ;D ). 
Also I can hardly do without sample that I patiently try to understand ( that's the way we learn isn't it ?)

In case of LAO, believe me, I was not the only one to wonder why some loadings were failing. Thank's to Tek, I could reconsiders this sample as "a demonstration  how the application react when there is failures" and discovered that business layer was in fact ramdomizing routines (...if only these Invoice, SaleOfOrder or DebitorAccount could have been xml files, it would already be done :) )

In case of LFA, you seems not considering your demo reliable enough for real application ( of course, we surely have not the same level of mastery). I don't agree and since then, I desperately try to replace the monitor I used, based on StartupMonitor proxy (included in AppSkeleton demo) by a LoadupMonitor instance. The former one was working just fine but loading up resources whenever needed and not just during startup phase is really interesting,indeed.

LFA nearly seems to answer my needs (i.e load and exploit in an ordered way some xml configuration files)
The only difference I see is about the view layer that is, in my case, no more required.  So I believe I can delete GroupOfAssets.mxml and its mediator but if as you suggest, I delete all others files, what should I replace it by ?  Where should go all business code from the GroupOfAssetsMediator, LoadAssetGroupInstructions.as LoadAssetGroupCommand ?




Title: Re: Loadup for Assets - A PureMVC AS3 / Flex / Loadup Utility Demo
Post by: philipSe on November 13, 2009, 04:37:07
Kouri,
If the LFA demo code is a good match to a real application requirement, then great.  I don't have doubts about reliability of the code.

As regards the group classes in the demo, are they not a closed set, so that they can all be dropped without compromising the handling of single assets?  Is there a cross-over that I'm missing?

Nice to see the translation - well done.
Bon Chance!
----Philip


Title: Re: Loadup for Assets - A PureMVC AS3 / Flex / Loadup Utility Demo
Post by: myIP on January 10, 2010, 05:56:57
Hello, what would be the preferred way to fire the following notification multiple of times for this example?

sendNotification( ApplicationFacade.LOAD_ASSET_GROUP, loadingInstructions() );

For instance if the initial line above returned several images and a XML file and if this XML file contains several other URLs for images to be loaded by the Loadup utility, how would I send a second request?

I did commented out the following lines below in the GroupOfAssetsMediator's onLoad method:

//loadBtn.enabled = false;
//loadBtn.removeEventListener( MouseEvent.CLICK, onLoad)
//controlsDisplayComponent.removeChild( loadBtn );


...and then in the AssetGroupProxy's removeAssetProxies method, I had to explicitly remove the Group proxy, as the following:

facade.removeProxy(ApplicationFacade.GROUP_ASSETS_GROUP_PROXY_NAME);


This seems to work but I am not sure if this is breaking the underlying pattern, what do you think?


Title: Re: Loadup for Assets - A PureMVC AS3 / Flex / Loadup Utility Demo
Post by: philipSe on January 11, 2010, 04:45:31
@myIP
You could let the completion of the first group of assets be as in the demo, with removal of the progress bar and the load button and the other cleanup stuff.  And let the next group be a totally new, independent load, for example
- the new loading instructions would/might specify a new instance name for the loadup monitor, but see below
- the new loading instructions would specify a new instance name for the new asset group proxy
- add a new load button, with a label that describes this particular group of assets
- and so on
- however the test of note type at the top of handleNotification would now have to be aware of which monitor was current.

----Philip


Title: Re: Loadup for Assets - A PureMVC AS3 / Flex / Loadup Utility Demo
Post by: puremvc on July 29, 2010, 02:57:16
This demo has been updated for the new 2.1 version of Loadup.

-=Cliff>