开发者

Does the [Bindable] metadata tag instantiate an Object by default?

开发者 https://www.devze.com 2023-03-08 16:34 出处:网络
I’m studying a demo code and it seems to me that an instance of a class is never instantiated, in particular I have this line:

I’m studying a demo code and it seems to me that an instance of a class is never instantiated, in particular I have this line:

<mx:Canvas ... currentState="{ model.state }">

...

[Bindable]
public var mod开发者_JAVA技巧el:MainUIPresentationModel;

If that’s not the case, please tell me, I’ll post the complete code.


@Constantiner Could it be:

<Injectors target="{ MainUI }">
    <PropertyInjector targetKey="model" source="{ MainUIPresentationModel }"/>
</Injectors>

?

Gosh this was a Mate question not a flex4 question. :( Sorry guys.


You should understand that this declaration:

[Bindable]
public var model:MainUIPresentationModel;

is just declaration. The [Bindable] metatag just lets others to handle changes of your target object (model) automatically. But this metatag doesn't instantiate the value of the property you've declared.

So you need to assign a value to your declared property somewhere in your code corresponding your application's logic. Declaration is not enough.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号