Tools

Namespaces

Variants

Views

Actions

Search

Contents

Please note that as of October 24, 2014, the Nokia Developer Wiki will no longer be accepting user contributions, including new entries, edits and comments, as we begin transitioning to our new home, in the Windows Phone Development Wiki. We plan to move over the majority of the existing entries. Thanks for all your past and future contributions.

Introduction

The example code below will load an online icon pack image (iconPackUrl) and then use the Map API's GFX library method (gfx.BitmapImage) to pick up images out of the pack defined by a position and a size.
These bitmaps will then be attached to map marker icons to be displayed onscreen.

Example Code

function addSpritesToMap(map){

var iconPackUrl ="./img/sprites.png";

// create an icon from the icon pack url, specify the size (30px x 30px) and an offset// in the image where icon is (35px from the left border, 35px from the top). greyPlaneBitmap =new nokia.maps.gfx.BitmapImage(iconPackUrl,null,30,30,35,35),// create a second icon from the same url, specify the size (28px x 27px) and another offset// in the image where icon is (5px from the left border, 72px from the top). greenPlaneBitmap =new nokia.maps.gfx.BitmapImage(iconPackUrl,null,28,27,5,72),// Create marker no 1 plane1 =new nokia.maps.map.Marker(new nokia.maps.geo.Coordinate(1.381667,173.166944),{ icon: greyPlaneBitmap}),// Create marker no 2 plane2 =new nokia.maps.map.Marker(new nokia.maps.geo.Coordinate(1.371667,173.146944),{ icon: greenPlaneBitmap});