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]. For more options, visit this group at http://groups.google.com/group/google-maps-js-api-v3?hl=en.
