Ahh!
I must use the proper MVCObject methods for on ALL properties that are
conencted to the bindTo() method...
So in my previous example:
myObject.property;
displays 1234 as expected.
myObject.childObject.property;
displays 1234 so it's initial value of 23 has been changed and it
looks like the bindTo() has been successful.
myObject.set('property', 999);
Firebug console reports undefined.
myObject.property;
displays 999 so the above myObject.set('property', 999); has set the
myObject property.
myObject.childObject.property;
displays 1234 so even though myObject.set('property', 999); has set
myObject.property it hasn't set myObject.childObject.property.
And now i can use:
myObject.get('childObject').get('property');
Which correctly reports 999 the new value.
That means that:
myObject.childObject.property!
==myObject.get('childObject').get('property');
Anyway thanks for the help.
Martin.
On Dec 7, 9:26 am, Ben Appleton <[email protected]> wrote:
> You need to call .get('property'), which follows the .bindTo() to obtain the
> value. We would do this for you using JavaScript getter methods but IE
> JScript lacks getters and the API must run consistently in all browsers.
>
> - Ben
> On 7 Dec 2010 18:56, "Martin" <[email protected]> wrote:
>
> > Hi all.
>
> > I have a general question about using the MVCObject bindTo() method.
>
> > I'm new to MVCObjects and am experimenting, i have a map that's made
> > up of 3 or 4 objects and i want them to share some common properties.
>
> > Let's say i have just 2 objects 'mainObject' and 'childObject' and i
> > want them both to have an identical property 'timestamp'.
>
> > I want to set the value of timestamp in mainObject and then
> > childObject's timestamp property will automatically be updated to
> > equal mainObject's timestamp property.
>
> > The MVCObject's bindTo() method looks to be exactly what i need but so
> > far i've had no success getting the childObject's timestamp to change
> > when i set mainObject's timestamp property.
>
> > I've put some code together - not using the above object names etc but
> > hopefully someone can see where i'm going wrong:
> >http://code.martinpearman.co.uk/mvcobject_test/index.htm
>
> > Now i'm using Firebug console to enter various comamnds:
>
> > myObject.property;
> > displays 1234 as expected.
>
> > myObject.childObject.property;
> > displays 1234 so it's initial value of 23 has been changed and it
> > looks like the bindTo() has been successful.
>
> > myObject.set('property', 999);
> > Firebug console reports undefined.
>
> > myObject.property;
> > displays 999 so the above myObject.set('property', 999); has set the
> > myObject property.
>
> > myObject.childObject.property;
> > displays 1234 so even though myObject.set('property', 999); has set
> > myObject.property it hasn't set myObject.childObject.property.
>
> > Trying to set properties directly without the MVCObject set method:
>
> > myObject.property=678;
>
> > myObject.property;
> > displays 678 as expected.
>
> > myObject.childObject.property;
> > displays 1234.
>
> > Can anyone see where i'm going wrong, i'd expect the 'undefined'
> > that's output when i used myObject.set('property', 999); to be a clue!
>
> > Thanks.
>
> > Martin.
>
> > --
> > You received this message because you are subscribed to the Google Groups
>
> "Google Maps JavaScript API v3" group.> To post to this group, send email to
>
> [email protected].> To unsubscribe from this group, send
> email to
>
> [email protected]<google-maps-js-api-v3%[email protected]>
> .> For more options, visit this group at
>
> http://groups.google.com/group/google-maps-js-api-v3?hl=en.
>
>
--
You received this message because you are subscribed to the Google Groups
"Google Maps JavaScript API v3" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-maps-js-api-v3?hl=en.