で使用されるすべての値を保持するPresentationModel
ASクラスがありますSomeView.mxml
。モデルのクラス全体がバインド可能であり、ビューのモデルプロパティもバインド可能です。ただし、PropertyInjector
タグを使用してモデルをビューに挿入できません。
- INFO: Data binding will not be able to detect assignments to model
FlexデータバインディングとMateに精通している人が私に手を貸してくれませんか?どうもありがとう!
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>