Friday, July 8, 2011

[Google Maps API v2] Problem creating custom GIcon

Previously I had something like this -

var gicons = [];

var baseIcon = new GIcon(G_DEFAULT_ICON);
baseIcon.iconAnchor = new GPoint(9,34);
baseIcon.iconSize = new GSize(20,34);
baseIcon.infoWindowAnchor = new GPoint(9,2);

gicons["home"] = new GIcon(baseIcon,"yellow.png");
gicons["red"] = new GIcon(baseIcon,"red.png");
gicons["green"] = new GIcon(baseIcon,"green.png");
gicons["blue"] = new GIcon(baseIcon,"blue.png");*/
It works fine.
Instead of the previous thread I want to re-write it like following -

var tags = ["home", "red","green", "blue"];
var tag_colors = ["yellow.png", "red.png", "green.png", "blue.png"];


for(var i=0; i<tags.length; i++){

if(tags[i]!=null){

gicons[tags[i]] = new
GIcon(baseIcon,tags_colors[i]);
}
}

But unfortunately it is not working. No idea why.

Can anyone help me please?

--
You received this message because you are subscribed to the Google Groups "Google Maps API V2" group.
To post to this group, send email to google-maps-api@googlegroups.com.
To unsubscribe from this group, send email to google-maps-api+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-maps-api?hl=en.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate