Results 1 to 3 of 3

Thread: [RESOLVED] Need help understanding object scope

  1. #1
    Join Date
    Mar 2011

    resolved [RESOLVED] Need help understanding object scope

    New to Javascript, couple of weeks now. Here is what I am trying to do.

    MapObj=new Object ();
    MapObj.map;  //This what I have problems with latter on
    MapObj.MyInt=65; //...
    //All the stuff in here works
    function initMap (strContainerID, numLatitude, numLongitude)
       MapObj.map = new FromVendorLib.Map(strContainerID);
    //So now I assume MapObj.map holds what I need, but
    //Now I crash at MapObj.map.
    function tempLoad()
          // All kinds of other stuff
          var SomeVar = new AnotherVendorThing.Thing(MapObj.map,
             someParameter : 40
    If I take the code from tempLoad and put it in
    initMap everything is fine. However I really want to keep my
    initialization and loading separate. So I assume I am missing
    a fundamental concept with scope and objects. Please educate me.

    Thank You

  2. #2
    Join Date
    Jul 2003
    The City of Roses
    The code you posted looks fine, which means your real problem is somewhere in the code you haven't shown us. The best thing you can do to get your question answered is to link to the actual page that's having the issue.

  3. #3
    Join Date
    Mar 2011

    That was it!

    Thanks for the kick, you helped me answer my question. With your re-assurance, what I did not mention is that I am working with multiple frames. The Init button was in the same frame, the Load button was not. When I move the load button to the same frame it works. Whole day shot for nothing! Anyway this will require research on HTML frames if I want to move it back. THANK YOU FOR ANSWERING!

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