Discussion Board

Results 1 to 5 of 5
  1. #1
    Registered User zonken's Avatar
    Join Date
    Dec 2012
    Posts
    2
    Hello,
    when following coding of my Application
    Code:
    var mapElement = document.getElementById("myID");
    map = new nokia.maps.map.Display(mapElement, {
           components : [  new nokia.maps.map.component.Behavior(),
    	        	new nokia.maps.map.component.ZoomBar(),
    			new nokia.maps.map.component.Overview(),
    			new nokia.maps.map.component.TypeSelector(),
    			new nokia.maps.map.component.ScaleBar() ],
    	// initial center and zoom level of the map
    	center : [ 52.51, 13.4 ],
    	zoomLevel : 10
    	});
    is called I get an error "Uncaught TypeError: Cannot read property 'Display' of undefined ".
    I only get this error, when I try to load the API on runtime:
    Code:
    	var script = document.createElement("script");
    	script.type = "text/javascript";
    	script.charset="utf-8";
    	script.async = true;
    	script.onload = myCallback;
    	script.src = "http://api.maps.nokia.com/2.2.3/jsl.js?with=all";
    	document.head.appendChild(script);
    myCallback is reached. But map is undefined. I also tried to work with the Features.load method to enforce another call back before I start accessing the map object but here I never got an callback:
    Code:
    nokia.Features.load({"map": "auto"}, function(){alert("123");},  function(){alert("321");});

    When I replace this with a static script tag in HTML head, everything works fine:
    Code:
    <script src="http://api.maps.nokia.com/2.2.3/jsl.js?with=all"
    	type="text/javascript">
    </script>
    But I prefer to do this on the fly. Any idea what I made wrong?

  2. #2
    Nokia Developer Moderator jasfox's Avatar
    Join Date
    Aug 2011
    Location
    Berlin
    Posts
    228
    It looks like a flaw in the design of the feature loader to me. At the moment the feature loader is usually used to add additional functionality (e.g. routing) after the base JavaScript library has already been loaded.

    For example load the basic library without the with parameter
    Code:
    <script src="http://api.maps.nokia.com/2.2.3/jsl.js" type="text/javascript">
    </script>
    and then use Features to add routing or places or whatever, does work. However it doesn't look like bootstrapping the complete library from the DOM is available at the moment.

    I know asynchronous loading is an advanced use case, but it seems reasonable to support it. I've had a discussion with the development team, and I'm lobbying to get the Feature documentation upgraded and the design flaw fixed in the next release cycle.
    Until this is implemented you'll have to stick with loading the basic library in the <SCRIPT> tag, I'm afraid.
    Jason Fox
    Technical Support Engineer, Maps Platform
    Location & Commerce

    http://developer.here.net/

  3. #3
    Registered User zonken's Avatar
    Join Date
    Dec 2012
    Posts
    2
    Hi Jason,
    thanks for the fast reply. It is good to know and I can stop spending time in looking what I made wrong.
    If there will be a async Feature in future; do you have an idea about the timeline, when it would be available?
    I Wish you a nice weekend.
    Regards,
    Rico

  4. #4
    Nokia Developer Moderator jasfox's Avatar
    Join Date
    Aug 2011
    Location
    Berlin
    Posts
    228
    Hi Zonken,

    I wouldn't like to commit to timeline, as the setting of priorities is not my call. Certainly the development team recognise the need for this and hope to get a fix out sooner rather than later. A proper mechanism for following bug fixes/feature requests is one of the items on the internal to-do list (DEVPRES-10), so in the mean time the best thing to do is to raise and follow any issues here.

    Regards,

    Jason.
    Jason Fox
    Technical Support Engineer, Maps Platform
    Location & Commerce

    http://developer.here.net/

  5. #5
    Nokia Developer Moderator jasfox's Avatar
    Join Date
    Aug 2011
    Location
    Berlin
    Posts
    228
    Asynchronous Loading support has been introduced in version 2.2.4 of the Maps API for Javascript:

    A worked example can be found in the wiki
    Jason Fox
    Technical Support Engineer, Maps Platform
    Location & Commerce

    http://developer.here.net/

Similar Threads

  1. Replies: 2
    Last Post: 2012-05-10, 14:31
  2. [moved] Device Discovery Load Errors
    By mukit027 in forum Carbide.c++ IDE and plug-ins (Closed)
    Replies: 1
    Last Post: 2011-07-09, 12:46
  3. [moved] why i can not load DLL on Nokia N73
    By sean_bean in forum Symbian C++
    Replies: 3
    Last Post: 2009-03-06, 14:47
  4. [Moved] Nokia 8800 Sirroco, won't load up...
    By Ross83 in forum General Development Questions
    Replies: 1
    Last Post: 2008-11-10, 17:12
  5. [Moved] Can't load debugging symbols (on-device)
    By Theril in forum Carbide.c++ IDE and plug-ins (Closed)
    Replies: 2
    Last Post: 2008-07-02, 11:55

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Nokia Developer aims to help you create apps and publish them so you can connect with users around the world.

京ICP备05048969号  © Copyright Nokia 2013 All rights reserved