In the context of 'theory of operation' i think every thing starts from the fact that this utility grew out of an exploration of best practices for initializing a PureMVC application. Today's applications rely on certain resources having been loaded before real work can begin and 'resources' means more that a list of images (as was often the case in earlier ages).
So StartupManager helps implement the loading (and verification of load status) 'resources' required by a given application. Resources is loosely defined to include configuration settings as represented by AppSkeleton and successful completion of some 'processes' in some specific order as seen in StartupAsOrdered.
New users should understand that they need to add code that defines what those resources are, and what constitutes a successful load. The utility includes methods that allow us to define dependencies and retry/timeout properties. Users should not look to the utility to provide graphic 'pre-loader' status type display.
Since the utility is a fully 'PureMVC creature', studying how various demos implement different processes will provide a better handle on PureMVC as a working framework. For example, looking at how a co-utility 'Asynchronous Stub' is used in StartupAsOrdered's delegate provides a powerful lesson in de-coupling dataprovers from a project while still delivering objects that fill-in until specfic backend data providers are needed.
>> Please consider the above thoughts to be a draft of 'theory of operation' overview and feel free to
>> specific other topics that need coverage or re-interpretation.
And now a request for some help with a demo that will show use of the utility to pre-load media (swf in this case) files where run-time code does not know the names of the files to be loaded.
I'm creating a pair of proxies that work together (each presumes the presence of the other) in a parent/child or ItemManager/Items relationship. AssetProxyList retrieves an xml file containing the names of SWF to be loaded. Upon successful load of that xml file AssetListProxy notifies the Startup Manager and fires the LoadAssetCommand which loops thru the list of assets creating a AssetProxy on each iteration.
The demo will run to completion without tossing an exception (which I count as a moral victory). However....it displays the message 'Loading Complete' after the AssetlistProxy has loaded but before the AssetProxy instances have started. Makes sense since prior to the loop that instantiate the Asset instances (the children) Startup Manager only knew about the ListProxy (parent).
Also, the Manager is generating a OutOfSynch message for each of the assets loaded ...even though it also generates those assets as successfully loaded. I think it has to do with how the Proxy registers itself - each iteration uses the same name for the StartupResourceProxy:
The constructor:
public function AssetProxy( swf2Load:String ):void {
NAME = swf2Load + "Proxy";
SRNAME = swf2Load + "SRProxy";
this.swf2Load = swf2Load;
super( NAME );
this.load();
}
then the load:
public function load() :void {
var delegate : LoadAssetDelegate = new LoadAssetDelegate(this, 'assets/' + swf2Load + '.swf', tempClipHolder );
delegate.load();
sendNotification( ApplicationFacade.ASSET_LOADING, swf2Load );
this.monitor = facade.retrieveProxy( StartupMonitorProxy.NAME ) as StartupMonitorProxy;
// This var definition should probably be created with a dynamic name - How?
var rAsset :StartupResourceProxy = makeAndRegisterStartupResource( SRNAME , this.NAME as IStartupProxy);
}
Additionally, I'd like to start all the loaded clips in and ArrayCollection within AssetListProxy so other code knows where to find/play those clips.
So I include this code in the AssetListProxy:
public function add2ClipHolder( assetClip: MovieClip):void{
clipHolder.addItem(assetClip);
}
public function ClipHolder():ArrayCollection{
return clipHolder;
}
And attempt to gain access to that object from the AssetProxy but have so far failed to success. Any thoughts how to handle this?
Further...this arrangement of AssetList and Assets is obviously a common pattern where a Manager maintains info on an 'x' number of items. What features/corrections/refinements would my code need to be more formally in-line with that pattern?
thx
--steve...