InitMonitor v.0.3: Not Just Another PureMVC Initialization Manager [AS3] · Jan 6, 09:44 PM
The initial release of InitMonitor was described as a minimalist initialization manager. After using it for a little while I decided I wanted something more robust and full featured. So instead of reinventing the wheel I thought to use the official PureMVC StartupManager and bundled Asset Loader. After working for a while on converting an existing project to this paradigm I came to the realization that these were not the tools for the job.
Thus was born this new release of InitMonitor, a major re-factor in that it removes all of the PureMVC internals (purists beware). I added features for robust progress notifications, and an optional weighting system for creating highly accurate progress widgets (this is a major shortcoming for StartupManger). For failure handling, you can specify the number of automatic retries and an adjustable timeout interval has been incorporated as well.
In general, the classes are even more flexible now. You can instantiate multiple InitMonitorProxy‘s at the same time, register them all with the facade and even run them in parallel if you want. (I haven’t actually tested this out, so please let me know if you have success.)
Some more optional classes have been added, which can serve as example or base implementations for your own project. One of these is a remoting class which uses MinimalRemoting. Utilizing the class looks something like this:
// This code usually goes in a PureMVC Command...var myRemoteImages:RemotingInitProxy = new RemotingInitProxy( "myRemoteImages", "http://localhost/amfphp", "MyClient.getImagesByCategory", "myCategoryName" );var myImageLoaderProxy:LoadImagesProxy = new LoadImagesProxy( "myImageLoaderProxy", myRemoteImages );var monitor:InitMonitorProxy = new InitMonitorProxy(); monitor.stop(); monitor.completeNotification = new Notification(ApplicationFacade.IMAGES_INIT_COMPLETE); monitor.addResources([myRemoteImages, myImageLoaderProxy]); monitor.start();
The example above assumes that you have created a proxy called LoadImagesProxy (probably by subclassing BulkAssetsProxy) which is responsible for loading the list of images retrieved by the RemotingInitProxy. The LoadImagesProxy accesses the list by calling myImageLoaderProxy.getData() from within the ImageLoaderProxy.load() function. When all the images have been loaded, the monitor will send the completeNotification.
InitMonitor also supports abrupt interruptions to the initialization process. Keep in mind that for this to work properly, you must fully implement the stop() function in all your IInitProxy‘s. The process can be stoped synchronously at any point after you call monitor.start(), where monitor is an instance of InitMonitorProxy that is busy.
Example
There is no full-fledged example yet. Right now my advice is to check out the documentation and do some experimenting. After you figured it all out, send me a copy of the source and I will post it here for all to see :P
Documentation
Goto InitMonitor Documentation
Download
— Pickle
Comment
MinimalRemoting: Simple Remoting Class without the Bells and Whistles [AS3] Seamlessly Combining 2D and 3D in Flash with Planes, Part 3 [AS3]

this looks really cool, but an example would be very helpful. trying to decipher your sample code in this post, the initial initmonitor post and the docs, it’s pretty confusing
— Trevor · Mar 10, 01:29 PM · #
in your example code you setup the proxy as a local var, but it’s not registered with the facade:
var myImageLoaderProxy:LoadImagesProxy = new LoadImagesProxy( “myImageLoaderProxy”, myRemoteImages );
so later on when your app receives the ApplicationFacade.IMAGES_INIT_COMPLETE notification, probably in a Mediator somewhere, how would you get a reference to the myImageLoaderProxy to pull the data out of it?
— Trevor · Mar 11, 12:12 PM · #
Trevor, I plan on getting some example code up eventually. In the meantime, I’ll do my best to answer any questions you may have.
You’re absolutely correct, the code should also include:
For the constructor of any proxy, the first argument is usually the proxy name, so you could retrieve the proxy this way:
— Pickle · Mar 13, 08:57 AM · #
One more thing, I actually would recommend that instead of retrieving the proxy to grab the data, in most circumstances it would make sense to send the relevant data directly from the Proxy to your Mediator via the Notification’s body property. The advantage to doing it this way is that your proxies will not be tightly coupled to the mediator.
So, in the example above LoadImagesProxy should do sendNotification( ApplicationFacade.LOADIMAGES_LOADED, notification_body_object ), after all the images have been loaded. The notification_body_object in this case might be an array of images. ApplicationFacade.LOADIMAGES_LOADED is just a const string that represents the name of the notification being sent. Then in your mediator:
And then later on in your mediator:
myArray should be declared at the top of the mediator class, and both notification should be listed in handleNotifications.
— Pickle · Mar 13, 10:05 AM · #
this actually looks really useful and really well documented – but how much work would be involved in making this work in the multicore version of puremvc? i ask this as something of a puremvc newbie
thanks!
— dee volume · May 5, 03:12 AM · #
Perform a find and replace in all files:
Find: org.puremvc.as3.
Replace with: org.puremvc.as3.multicore.
that’s it!
Please be sure to download the latest version here.
— Pickle · May 5, 04:15 PM · #