Josh,
Is it a right way to do the following:
[Bindable] private var xyz:String = MyModel.getInstance().someVar;
Now, if I use xyz in my code then it is not updated. Where as if i use
'MyModel.getInstance().someVar' then I am getting perfect result.
For Ex:
<mx:Label text="{xyz}"/> // view not updated with changes in model.
<mx:Label text="{MyModel.getInstance().someVar}"/> //view updated everytime
with changes in model.
So, I didn't get the difference between two above logically.
Please explain the case as above. Thanks.
Josh McDonald-4 wrote:
>
> I get what you're saying, but you're coming at it from the wrong angle is
> all.
>
> When you have this:
>
> [Bindable]
> public var myvar = someFunction();
>
> You're making it so that *other code* will be called when myvar changes.
> You're also giving it the initial value of someFunction(). It won't
> "escape"
> back into the code for someFunction() and alter it so it becomes bindable.
> We need to have a difference betwen "X = Y" and "create a binding from X
> to
> Y", otherwise the entire virtual machine would slow to a crawl.
>
> If you want to create a binding from actionscript from
> "sourceObject.someValue" to "myValue" you do this:
>
> BindingUtils.bindProperty(this, "myValue", sourceObject, "someValue");
>
> Then whenever sourceObject tells the word that "someValue" has been
> updated
> (with events), Flex will set the "myValue" field on your object.
>
> -Josh
>
> On Mon, Sep 22, 2008 at 1:07 PM, Manu Dhanda
> <[EMAIL PROTECTED]>wrote:
>
>>
>> Hi Paul,
>>
>> if [Bindable] works just for initialization, then I think it is loosing
>> it's
>> existence altogether.
>>
>> At least I think it this way.. that [Bindable] changes with every change
>> that it is bind to. And not just it's initialization.
>>
>> Waiting for expert comments..
>>
>> Thanks,
>> Manu.
>>
>>
>> Paul Andrews-4 wrote:
>> >
>> > ----- Original Message -----
>> > From: "Manu Dhanda" <[EMAIL PROTECTED]>
>> > To: <[email protected]>
>> > Sent: Monday, September 22, 2008 3:08 AM
>> > Subject: [flexcoders] [Bindable] is not getting updated..
>> >
>> >
>> >>
>> >> Hii Guyz,
>> >>
>> >> Although it's very strange (even for me), but this [Bindable] tag is
>> not
>> >> working for me.
>> >>
>> >> I am following the cairngorm structure and storing a variable in
>> Model.
>> >>
>> >> Now, in one of my code file, if I 'll create a local bindable
>> variable,
>> >> that
>> >> binds to model.. then it is not being updated with the changes in
>> model.
>> >>
>> >> [Bindable] private var xyz:String = MyModel.getInstance().someVar;
>> >>
>> >> Now, if I use xyz in my code then it is not updated. Where as if i use
>> >> 'MyModel.getInstance().someVar' then I am getting perfect result.
>> >>
>> >> Any thoughts here...
>> >
>> > Yes, some thoughts.
>> >
>> > [Bindable] private var xyz:String = MyModel.getInstance().someVar
>> >
>> > Means that xyz is bindable and is initialised with the value of
>> > MyModel.getInstance().someVar .
>> >
>> > It does not mean that xyz changes with the value of
>> > MyModel.getInstance().someVar .
>> >
>> > If you wish to have a binding in an mxml file to
>> > MyModel.getInstance().someVar then use "{MyModel.getInstance().someVar
>> > }",
>> > alternatively in actionscript you'll have to specifically set up a
>> binding
>> > for it.
>> >
>> > Paul
>> >
>> >
>> >
>> >
>> >>
>> >> Regards,
>> >> Manu.
>> >> --
>> >> View this message in context:
>> >>
>> http://www.nabble.com/-Bindable--is-not-getting-updated..-tp19600797p19600797.html
>> >> Sent from the FlexCoders mailing list archive at Nabble.com.
>> >>
>> >>
>> >> ------------------------------------
>> >>
>> >> --
>> >> Flexcoders Mailing List
>> >> FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
>> >> Alternative FAQ location:
>> >>
>> https://share.acrobat.com/adc/document.do?docid=942dbdc8-e469-446f-b4cf-1e62079f6847
>> >> Search Archives:
>> >> http://www.mail-archive.com/flexcoders%40yahoogroups.comYahoo! Groups
>> >> Links
>> >>
>> >>
>> >>
>> >>
>> >
>> >
>> >
>>
>> --
>> View this message in context:
>> http://www.nabble.com/-Bindable--is-not-getting-updated..-tp19600797p19601220.html
>> Sent from the FlexCoders mailing list archive at Nabble.com.
>>
>>
>> ------------------------------------
>>
>> --
>> Flexcoders Mailing List
>> FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
>> Alternative FAQ location:
>> https://share.acrobat.com/adc/document.do?docid=942dbdc8-e469-446f-b4cf-1e62079f6847
>> Search Archives:
>> http://www.mail-archive.com/flexcoders%40yahoogroups.comYahoo! Groups
>> Links
>>
>>
>>
>>
>
>
> --
> "Therefore, send not to know For whom the bell tolls. It tolls for thee."
>
> http://flex.joshmcdonald.info/
>
> :: Josh 'G-Funk' McDonald
> :: 0437 221 380 :: [EMAIL PROTECTED]
>
>
--
View this message in context:
http://www.nabble.com/-Bindable--is-not-getting-updated..-tp19600797p19601339.html
Sent from the FlexCoders mailing list archive at Nabble.com.