I am loading the Bing Map API script dynamically. When the script finishes loading, I would like to construct my map. The problem is Microsoft
and Microsoft.Maps
are defined, but Microsoft.Maps.Map
is not. I realize that their script will asynchronously load more scripts, but even after waiting 10 seconds for these additional hypothetical scripts, Microsoft.Maps.Map
continues to be undefined. So how do I load their Map
class? I see nothing in their example, that explicitly loads the class.
Javascript (Prototype Framework):
var script = new Element(
'script', {
type: 'text/javascript',
src: 'http://ecn.dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=7.0'
}
);
script.observe(
'load',
function(event) {
console.info(Microsoft);
console.info(Microsoft.Maps);
console.info(Microsoft.Maps.Map);
}
);
document.body.appendChild(script);
Console Output:
>>> Microsoft
Object { Maps={...}}
>>> Microsoft.Maps
Object { Globals={...}}
>>> Microsoft.Maps.Map
undefined