我有一个PresentationModel
AS类,其中包含SomeView.mxml
中使用的所有值。模型的整个类都是可绑定的,并且视图中的模型属性也是可绑定的。然而,我无法使用PropertyInjector
标签注入模型到视图:注入由OjbectBuilder创建的对象作为属性来查看
- INFO: Data binding will not be able to detect assignments to model
会有人与熟悉并且灵活数据绑定和队友给我个忙吗?非常感谢!
MainEventMap.mxml
<EventHandlers type="{FlexEvent.INITIALIZE}">
<ObjectBuilder generator="{PresentationModel}" registerTarget="true">
<Properties dispatcher="{scope.dispatcher}"/>
</ObjectBuilder>
</EventHandlers>
<Injectors target="{SomeView}" debug="true">
<PropertyInjector targetKey="model" source="{PresentationModel}" />
</Injectors>
段从PresentationModel.as
[Bindable]
public class PresentationModel extends EventDispatcher
{
public var dispatcher:IEventDispatcher;
//.....other variables and functions
}
段从SomeView.mxml
<mx:Canvas xmlns:mx="http://www.adobe.com/2006/mxml" width="518" height="562" >
<mx:Script>
<![CDATA[
//...... all the imports
[Bindable]
public var model:OSGiBrokerConsoleModel;
// ......other variables and functions
]]>
</mx:Script>
// ..... actual view components
</mx:Canvas>
PresentationModel的其余部分是什么样的? – Stiggler 2009-11-10 18:07:46