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

Pages: [1]
Author Topic: How to register Mediator of children components  (Read 9781 times)
Posts: 7

View Profile Email
« on: July 20, 2010, 02:40:47 »

My main view component is call children components as follows:

var classRefrence:Class=getDefinitionByName(podList[i].podcomponent) as Class;
        var myvbox:Object=new classRefrence() as Object;
pod.addChild(myvbox as DisplayObject);
myvbox is load the children component.Now, I have a children component named "AddRecordForm" and the mediator named "AddRecordListMediator".How do register AddRecordListMediator?
Global Moderator
Hero Member
Posts: 2871

View Profile WWW Email
« Reply #1 on: July 22, 2010, 07:48:31 »

A good way is to have a mediator that is attached upstream (like at the application level) that listens for the bubbling event that is dispatched when the component is added to the view hierarchy. This contains a reference to the newly added component, and you can wrap the appropriate mediator around it. Check out the Slacker flex demo for one approach to this. In that case it's components that are added to the view hierarchy by deferred instantiation, but the concept is the same.

Pages: [1]