Futurescale, Inc. PureMVC Home

The PureMVC Framework Code at the Speed of Thought


Over 10 years of community discussion and knowledge are maintained here as a read-only archive.

New discussions should be taken up in issues on the appropriate projects at https://github.com/PureMVC

Show Posts

* | |

  Show Posts
Pages: [1]
1  Announcements and General Discussion / Architecture / Re: Where to instantiate runtime UI components? on: May 15, 2008, 05:04:44
Hi Cliff,

Thanks for the tip. I am now registering the mediators without view components and letting the mediators themselves create their components upon received notification, and then sending them on in another notification (ADD_COMPONENT) that the main mediator is listening to. Works like a charm!

And thanks for a great framework! :)
2  Announcements and General Discussion / Architecture / Where to instantiate runtime UI components? on: May 14, 2008, 08:42:49
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? :P

Thanks!
Pages: [1]