Hi,
I'm working on an app (pure AS3, using FlexBuilder but not Flex) where parts of the ui will be created at runtime when a notification from a server is received that data needed for the ui is received. I have a base ui class that has it's own mediator, but no other ui components. When all is finished loaded from the server, a notification is sent out ("createUI") by a proxy, but here comes my problem - where to instantiate all my ui components so i can register their mediators? My thought was to have a CreateUiCommand that register the mediators, but I feel uncomfartable creating the ui components in there. The base ui class own mediator will probably handle notifications for laying out the created components when they are all done, but where to create them? In a proxy or in a command, or maybe in the base ui's mediator? I cannot have them in the base ui class since they can't be instantiated at startup. There are around 10 components that have to be created at runtime...
In short, where to put this code:
var dataFromServer:Object = notification.getBody();
var myComponent:MyComponent = new MyComponent( dataFromServer );
registerMediator( new MyComponentMediator( myComponent ) );
Do I make any sense?
Thanks!