That syntax tells the browser to call BoundsChanged() *immediately* and
expects it to return a function reference. When the event triggers, the
callback function passes control to whatever BoundsChanged() returned.
That's not what you want.
In this case you can write
google.maps.event.addListener(gsmapsrc, 'bounds_changed',BoundsChanged);
Without the (), "BoundsChanged" is a function reference.
With the (), "BounsdChanged()" calls the function now and uses whatever
it returns as the function reference.
In the general case, where you have variables to pass from *your* code
to the callback function, you'd write
function createListener(foo,bar,baz) {
google.maps.event.addListener(gsmapsrc, 'bounds_changed', function() {
BoundsChanged(foo,bar,baz);
});
}
using the outer function to hold Function Context on the variables.
--
Mike Williams
Gentleman of Leisure