www.webdeveloper.com
Results 1 to 3 of 3

Thread: Newbie: I cannot get an event to pass from one js class to another...

Hybrid View

  1. #1
    Join Date
    Jan 2013
    Posts
    2

    Newbie: I cannot get an event to pass from one js class to another...

    I am using bing maps.
    On the load of the map I have
    Code:
    Maps.Events.addHandler(_map, 'viewchangeend', displayEventInfo);
    Which calls
    Code:
    function displayEventInfo() {
        	ListMapIntegration.displayEventInfo(e);
        };
    Which calls another js class which is:
    Code:
    ListMapIntegration = (function () {
    	
    	function displayEventInfo(e) {
            alert("map moved");
        }
    });
    I am getting an error in chrome:
    Code:
    Uncaught TypeError: Object function () {
    	
    	function displayEventInfo(e) {
            alert("map moved");
        }
    } has no method 'displayEventInfo'
    I am not sure how to describe this problem. Please let me know if there is anything I else I can provide''

    Thanks!

  2. #2
    Join Date
    Aug 2008
    Location
    Sweden
    Posts
    227
    Quote Originally Posted by dadoprso View Post
    Code:
    ListMapIntegration = (function () {
        
        function displayEventInfo(e) {
            alert("map moved");
        }
    });
    should probably be something like

    Code:
    ListMapIntegration = {
        displayEventInfo: function(e) {
           alert("map moved");
       }
    };
    displayEventInfo becomes a method on the ListMapIntegration object this way.
    New to web development or in need of a good reference? Check out the Mozilla Developer Network or W3Schools.

  3. #3
    Join Date
    Jan 2013
    Posts
    2
    Quote Originally Posted by ReFreezed View Post
    should probably be something like

    Code:
    ListMapIntegration = {
        displayEventInfo: function(e) {
           alert("map moved");
       }
    };
    displayEventInfo becomes a method on the ListMapIntegration object this way.
    Awesome! Thanks.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles