as a trainload of contrast to my last post, I’m playing with Robots.
this simply is a Robotlegs app which levies BulkLoader and pulls assets from paths specified in XML.
the XML format resembles:
<model>
<assets>
<asset source="assets/bob.jpg" loadGroup='preload' />
<asset source="assets/robyn.jpg" loadGroup='secondState' />
<asset source="assets/clown.jpg" loadGroup='secondState' />
</assets>
</model>
the loadGroup identifier allows you to break your preload into stages. anything tagged ‘preload’ is pulled automatically on STARTUP_COMPLETE. subsequent calls to yourModelProxyInstance.loadState(state:String) pull whichever state you specify.
there is no ‘name’ or ‘id’ identifier because this is parsed from the URL. saves a bit of redundancy – “assets/bob.jpg” gets the following key in BulkLoader: ‘bob’.
I’m completely abusing flash.utils.describeType in my BaseObject class. it’s there to help you develop more quickly.
if you know exactly where your code is going, BaseObject is overblown. if your project’s specifications flop around like trout on a dock, BaseObject handles your busywork.
as an example, the following copies like properties from the passed-in object:
var varList:XMLList = describeType(this)..variable;
i=0;
l=varList.length();
for(i; i < l; i++)
{
var prop:* = String(varList[i].@name);
if (passedInObject.hasOwnProperty(prop)) {this[prop] = passedInObject[prop];}
}
any change requests, just ask. especial thanks to John Lindquist for the best of the Robotlegs tutorials.