I have a custom list component, that takes in XML and displays a UI object for
each element. Each of these UI objects can grow and shrink in size, and might
have to overlap, so I cannot use an itemrenderer. The custom container has a
commitProperties method that goes roughly like this:
protected override function commitProperties():void {
super.commitProperties();
if(_dataProviderDirty){
for each(var el:XML in dataProvider){
var newChild:CustomUITile = new
CustomUITile();
newChild.data = el;
addChild(newChild);
}
}
_dataProviderDirty = false;
}
I'm wondering if this commitProperties method is the right place to do these
child instantiations? The CustomUITiles are kinda detailed, and can take ~30ms
to construct and add a single object. If there are 50 object, that leads to
noticable slowdown for users.
Is there a better way I should be handling these constructions? I don't mind if
the overall time to create the objects is unchanged, but I don't want the UI to
lock up.
I've been experimenting with breaking up the instantiations using a Timer, so
Flash can update the screen in between workloads, but I'm wondering if I'm just
making bad use of the Flex component lifecycle, and that is causing the delay...
Thanks for any advice!