Object Created but not Consumed?

22 views
Skip to first unread message

A. Shore

unread,
Jun 10, 2012, 11:26:13 AM6/10/12
to Google Maps JavaScript API v3
Folks, in the snippet below, object marker_obj is created but with no
further reference that I see.

But beachMarker icon doesn't display unless marker_obj is indeed
defined.

Can someone explain the (apparently) invisible reference?


function init() { // Called on the intiial page load.
var map_obj = new
google.maps.Map(document.getElementById('map_canvas'), {
zoom: 14,
center: new google.maps.LatLng(37.44, -122.14),
mapTypeId: google.maps.MapTypeId.ROADMAP
});

var marker_obj = new google.maps.Marker({
position: new google.maps.LatLng(37.43, -122.13),
map: map_obj
});

var image_file = 'http://code.google.com/apis/maps/documentation/v3/
examples/images/beachflag.png';
var beachMarker = new google.maps.Marker({
position: new google.maps.LatLng(37.45, -122.15),
map: map_obj,
icon: image_file
});
} // end function init()

Michael Geary

unread,
Jun 10, 2012, 3:39:47 PM6/10/12
to google-map...@googlegroups.com
Can you post the URLs of two versions of your map page, one working and one showing the problem? Or at least a URL for the broken page?


--
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 google-map...@googlegroups.com.
To unsubscribe from this group, send email to google-maps-js-a...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-maps-js-api-v3?hl=en.


Dave Medlicott

unread,
Jun 11, 2012, 1:18:52 PM6/11/12
to google-map...@googlegroups.com
The link to the image file doesn't work. If I put a good link in, then it works fine for me with or without the code for the first marker.

A. Shore

unread,
Jun 11, 2012, 9:27:31 PM6/11/12
to Google Maps JavaScript API v3
Thanks, but there is no "problem", and therefore nothing to show.

My question is how defining 'marker_obj' in the noted snippet worked,
since it played no visible - to me, anyway - role in the init()
function

AS

On Jun 10, 3:39 pm, Michael Geary <m...@mg.to> wrote:
> Can you post the URLs of two versions of your map page, one working and one
> showing the problem? Or at least a URL for the broken page?
>
>
>
>
>
>
>
> On Sun, Jun 10, 2012 at 8:26 AM, A. Shore <shor...@gmail.com> wrote:
> > Folks, in the snippet below, object marker_obj is created but with no
> > further reference that I see.
>
> > But beachMarker  icon doesn't display  unless marker_obj is indeed
> > defined.
>
> > Can someone explain the (apparently) invisible reference?
>
> >        function init() {
> >             // Called on the intiial page load.
> >                var map_obj = new
> > google.maps.Map(document.getElementById('map_canvas'), {
> >                        zoom: 14,
> >                        center: new google.maps.LatLng(37.44, -122.14),
> >                        mapTypeId: google.maps.MapTypeId.ROADMAP
> >                        });
>
> >                var marker_obj = new google.maps.Marker({
> >                        position: new google.maps.LatLng(37.43, -122.13),
> >                        map: map_obj
> >                        });
>
> >                var image_file = '
> >http://code.google.com/apis/maps/documentation/v3/
> > examples/images/beachflag.png<http://code.google.com/apis/maps/documentation/v3/examples/images/bea...>
> > ';

Steve Ai

unread,
Jun 11, 2012, 5:36:19 PM6/11/12
to google-map...@googlegroups.com
Yeah...it was the image file, got it fixed...Thanks Alot for the response...!

On Mon, Jun 11, 2012 at 6:18 PM, Dave Medlicott <dme...@gmail.com> wrote:
The link to the image file doesn't work. If I put a good link in, then it works fine for me with or without the code for the first marker.

--
You received this message because you are subscribed to the Google Groups "Google Maps JavaScript API v3" group.
Reply all
Reply to author
Forward
0 new messages