screen overlay does not update when icon is changed

81 views
Skip to first unread message

LarsH

unread,
Sep 27, 2010, 2:06:19 PM9/27/10
to KML Developer Support - Google Earth Plug-in
Hello,

I have a Google Earth plug-in 1.0.0.1 map that uses two Screen
Overlays. One of them is meant to function as a "pause" button, whose
image will be toggled between Play (>) and Pause ( || ) images.

When I give the overlay its initial image (looks like || ), it
displays fine.
But when I try to change the image (to look like >), nothing happens.

I tried both changing the href of the overlay's icon:

pauseButtonOverlay.getIcon().setHref('images/play1.png');

and replacing the overlay's icon with a new one:

var icon = ge.createIcon('');
icon.setHref('images/play1.png');
pauseButtonOverlay.setIcon(icon);

No errors are reported.
I can check the value of the Href in the javascript console:

>>> pauseButtonOverlay.getIcon().getHref()
"images/play1.png"

and it is the URL of the new play icon.
However, the overlay continues to display the old icon.

Am I doing something wrong?
Do I have to create a new screen overlay?

I'm using Windows 7, tested in Firefox 3.6.10 and IE 8.0.7600.16385

My app is currently at
http://www.huttar.net/lars-kathy/tmp/visitor-map-earth-bugreport.html
(subject to change)

I just posted a bug report on this (http://code.google.com/p/earth-api-
samples/issues/detail?id=536), but it occurred to me I should ask in
this group to see if I'm doing something wrong.

Thanks for any help,
Lars

LarsH

unread,
Sep 27, 2010, 2:56:21 PM9/27/10
to KML Developer Support - Google Earth Plug-in
P.S.
According to the Earth API ref docs at
http://code.google.com/apis/earth/documentation/reference/interface_g_e_plugin.html#b5dae994338298aaa1629a0f8a46c709
you can set the refresh mode for an overlay icon

"readonly KmlRefreshModeEnum GEPlugin.REFRESH_ON_CHANGE
Refresh when the file is loaded and whenever the Link parameters
change. This refresh mode is the default."

I hadn't realized there were different refresh modes. However,
REFRESH_ON_CHANGE is the default and that seems to be what I want.
I checked that my icon is indeed using that mode:

>>> pauseButtonOverlay.getIcon().getRefreshMode()
0
>>> ge.REFRESH_ON_CHANGE
0

Yep. So, it should be working... shouldn't it?

Lars

On Sep 27, 1:06 pm, LarsH wrote:
> Hello,
>
> I have a Google Earth plug-in 1.0.0.1 map that uses two Screen
> Overlays. One of them is meant to function as a "pause" button, whose
> image will be toggled between Play (>) and Pause ( || ) images.
>
> When I give the overlay its initial image (looks like || ), it
> displays fine.
> But when I try to change the image (to look like >), nothing happens.
> ...
Reply all
Reply to author
Forward
0 new messages