none
Microsoft.Maps.loadModule not calling callback function RRS feed

  • Question

  • Hello everyone,

    I started Windows 8 Metro App Development yesterday, and for my first JS app, I would like to use a BingMap.
    I found many doc in the MSDN Library to start with, but now I'm stuck on a problem : the map is not loading. I used some breakpoints to determine the origin of the problem, and it seems the callback assigned to the Microsoft.Map.loadModule is never called.

    // default.js
    function initialize() {
        Microsoft.Maps.loadModule('Microsoft.Maps.Map', { callback: initMap });
    }
    document.addEventListener("DOMContentLoaded", initialize, false);


    Here is the function initMap and the declaration of map:

    // default.js
    var map;
    var initMap = function () {
       try {
            var mapOptions = {
                credentials: /* My Bing Map Key */,
                center: new Microsoft.Maps.Location(40.71, -74.00),
                mapTypeId: Microsoft.Maps.MapTypeId.road,
                zoom: 8
            };
            map = new Microsoft.Maps.Map(document.getElementById("mapdiv"), mapOptions);
        }
        catch (e) {
            var md = new Windows.UI.Popups.MessageDialog(e.message);
            md.showAsync();
        }
    };

    I found these lines on many code examples and tried to reuse them. I also triple-checked my Bing Map Key.

    I used the following resources to build this first application :

    None of these example codes will display a map.

    Does anybody have an idea about how to solve this problem or its origin? 


    Thursday, June 21, 2012 4:28 PM

Answers

  • My problem finally came from the fact I was using Windows 8 in a VM.

    Everything works fine with Windows 8 installed on a DD.

    Friday, June 22, 2012 4:12 PM