Question

I have this styles in api 1.0

var s = new YMaps.Style();
s.iconStyle = new YMaps.IconStyle();
s.iconStyle.offset = new YMaps.Point(-1, -30);
s.iconStyle.href = "http:www.example.com/images/1.png";
s.iconStyle.size = new YMaps.Point(29, 28);
s.iconStyle.shadow = new YMaps.IconShadowStyle();
s.iconStyle.shadow.offset = new YMaps.Point(2, -12);
s.iconStyle.shadow.href = "http:www.example.com/images/2.png";
s.iconStyle.shadow.size = new YMaps.Point(29, 7);

here I add this styles to placemark

var placemark = new YMaps.Placemark(new YMaps.GeoPoint(lat, long),
                            {hasBalloon: false,
                              style: s
                            });
                          placemark.setHintContent(mystring);
                          placemark.enableHint();
                          map.addOverlay(placemark);

how create this styles in api 2.0 ?

Was it helpful?

Solution

I solve like this :

placemark.options.set('iconImageHref', 'http:www.example.com/images/1.png');
                placemark.options.set('iconImageOffset', [-1, -30]);
                placemark.options.set('iconImageSize', [28,29]);
placemark.options.set('iconShadowImageHref', 'http:www.example.com/images/2.png');
                placemark.options.set('iconShadowImageOffset', [2, -12]);
                placemark.options.set('iconShadowImageSize', [29, 7]);
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top