This is a little different from your first question.
Viewing classes MUST NOT directly access model classes, and because of this, the View class must send an event to change the model class.
1.) You must define some new event
public class ViewPropIsChangedEvent extends Event
{
public static const SET_NEW_VALUE:String = "theNewValue";
private var _value:Object;
public ViewPropIsChangedEvent(type:String, value:Object, bubbling:Boolean=true, cancelable:Boolean=false)
{
super(type,bubbling,cancelable);
_value = value;
}
public function get value():Object
{
return _value;
}
}
2.) When you change the ViewProp in View.mxml, you should send an event
dispatchEvent(new ViewPropIsChangedEvent(ViewPropIsChangedEvent.SET_NEW_VALUE, theNewValue))
3.) In EventMap you must handle the event
</EventHandlers type="{ViewPropIsChangedEvent.SET_NEW_VALUE}">
<PropertySetter generator="{ClassManager}"
targetKey="ClassProp"
source="{event.value}"/>
</EventHandlers>
4.) In ModelMap, you should already bind Secondview.SecondProp to ClassManager.ClassProp
<Injectors target="{Secondview}">
<PropertyInjector targetKey="SecondProp"
source="{ClassManager}"
sourceKey="ClassProp"/>
</Injectors>
source
share