Hey guys,
first of all - many thanks to all your incredible work on puremvc. I've done 2 successfull projects with it and less pain then with self written mvc frameworks.
In my new project I'm using the StartupManager for loading my init assets. That works really nice. But I also want to use it for...
... loading assets e.g. in the background while user is surfing the website.
... loading assets on demand e.g. a header image per page
... request asset; if loaded retrieve it; if not loaded, start loading; if loading in process, connect listeners to show loading process
I don't know if its the right utility for it. In my last projects I used the Bulkloader to do so....
I'm fine with sending notfications and I understand the differents bewteen frameworks using the flash event handling but it feels more comfortable for the on demand asset loading. For example:
The code is only fictitious to illustrate my approach:
In my mediator e.g. HeaderMediator:
var newAsset : AssetProxy = facade.retrieveProxy('images/header/header_xyz.jpg');
if(newAsset) {
if(newAsset.isLoaded) {
_headerComponent.update(newAsset.asset.data as UIComponent);
} else if (newAsset.getBytesLoaded() > 0) {
newAsset.addEventListener(LoaderEvent.PROGRESS, progressHandler); // e.g. iupdates the progress bar
newAsset.addEventListener(LoaderEvent.COMPLETE, completeHandler); // updates the asset in the _headerComponent
}
} else {
newAsset = facade.registerProxy('images/header/header_xyz.jpg');
newAsset.addEventListener(LoaderEvent.PROGRESS, progressHandler);
newAsset.addEventListener(LoaderEvent.COMPLETE, completeHandler);
newAsset.load();
}
Does anyone has experience for using the AssetLoader for asset loading after startup? I dont want to use two loader utilities.
#####UPDATE: I think that guy has the same problem...
http://theresidentalien.typepad.com/ginormous/2009/01/startup-manager-for-puremvc.htmlCheers