none
Microsoft.Maps.Color object removed in Bing Maps 8 api? RRS feed

  • Question

  • Hello,

    I am trying to save some different color values to be utilized later in my program.

    I am using the exact code from the documentation:

    var

    fillColor=newMicrosoft.Maps.Color(10,0,204,102);

    Yet, the script crashes when it hits this line? has the color object been removed in ver 8?


    What's up.

    Wednesday, August 17, 2016 8:21 PM

Answers

  • The color class is supported in V8. I tried your code and assuming that the missing space between "new" and "Microsoft" in your code is a copy/paste error, it works fine when I test in both the experimental and the main release branch of V8. Is the Microsoft.Maps namespace loaded before you try calling this class? Try adding a break point on this line of code and check to see if the color class or the namespace is undefined. If it is, then you trying to access the color class before it has loaded into the browser. Take a look at how you are loading the map script. If it is asynchornously being loaded, then you will need to wait until the specified callback function is loaded before you can access the Microsoft.Maps namespace.

    Documentation on the color class can be found here: https://msdn.microsoft.com/en-us/library/mt712639.aspx

    V8 also has additional support for CSS colors as documented here: https://msdn.microsoft.com/en-us/library/mt712639.aspx


    [Blog] [twitter] [LinkedIn]

    Wednesday, August 17, 2016 9:55 PM
  • IE 11, I was able to fix it. For some reason I had to run it with all my other code stripped out, just load the map and it worked. Then as I added all the other code back in it worked. I cleared the cashes multiple times but I guess that didn'tfix it. Well anyway its working now. Still not sure why it didn't work the first time. Thank you.

    What's up.

    Thursday, August 18, 2016 7:23 PM

All replies

  • The color class is supported in V8. I tried your code and assuming that the missing space between "new" and "Microsoft" in your code is a copy/paste error, it works fine when I test in both the experimental and the main release branch of V8. Is the Microsoft.Maps namespace loaded before you try calling this class? Try adding a break point on this line of code and check to see if the color class or the namespace is undefined. If it is, then you trying to access the color class before it has loaded into the browser. Take a look at how you are loading the map script. If it is asynchornously being loaded, then you will need to wait until the specified callback function is loaded before you can access the Microsoft.Maps namespace.

    Documentation on the color class can be found here: https://msdn.microsoft.com/en-us/library/mt712639.aspx

    V8 also has additional support for CSS colors as documented here: https://msdn.microsoft.com/en-us/library/mt712639.aspx


    [Blog] [twitter] [LinkedIn]

    Wednesday, August 17, 2016 9:55 PM
  • Hello,

    I am not loading the map script asynchronously. I added a break point to the script file, the Microsoft.Maps namespace is loaded, but it does not contain the color class. Very strange. I am assuming that the map object must be created before the entire namespace is loaded? api 7 was not like this, when the script was loaded there were no problems in creating the color class before creating the map object.


    What's up.

    Thursday, August 18, 2016 1:17 PM
  • I think I may have found the source of my issues. I removed all of the color objects I was creating and now I am receiving a new error in the maps api itself:

    Unhandled exception at line 11, column 7075 in http://www.bing.com/api/maps/mapcontrol?branch=release

    0x800a138f - JavaScript runtime error: Unable to get property 'prototype' of undefined or null reference.

    This is the code in the api that is causing the problem:

    k

    (n,t){varr=Object.create(n.prototype),i=n.apply(r,t);returni&&typeofi=="object"?i:r}


    What's up.

    Thursday, August 18, 2016 1:22 PM
  • What browser are you using?

    [Blog] [twitter] [LinkedIn]

    Thursday, August 18, 2016 6:57 PM
  • IE 11, I was able to fix it. For some reason I had to run it with all my other code stripped out, just load the map and it worked. Then as I added all the other code back in it worked. I cleared the cashes multiple times but I guess that didn'tfix it. Well anyway its working now. Still not sure why it didn't work the first time. Thank you.

    What's up.

    Thursday, August 18, 2016 7:23 PM