Mike,

This is true, but the second line:

> >    Rectangle.prototype = new google.maps.Overlay();

is not going to be executed even with two-pass parsing and the object
is not properly defined at the time when addOverlay calls initialize()
function; hence the error. When I call addOverlay after all prototype
assignments are done everything works.

Paul.

On Sep 24, 1:35 am, Mike Williams <[email protected]> wrote:
> Wasn't it Paul Kulchenko who wrote:
>
> >Answering my own question for the second time today: need to *use* the
> >inherited class after it's properly *defined*.
>
> >      map.addOverlay(new Rectangle(rectBounds));
>
> >should be *after*
>
> >    function Rectangle(bounds, opt_weight, opt_color) {
> >      ...
> >    }
> >    Rectangle.prototype = new google.maps.Overlay();
>
> Depends on the browser. In browsers with single-pass parsing, you can
> only use things that have been declared in part of the code that has
> already been parsed. In browsers with two-pass parsing, the first pass
> resolves all the function declarations in the whole file, so all
> functions are accessible during the execution pass.
>
> --
> Mike Williamshttp://econym.org.uk/gmap
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Maps API" 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-api?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to