www.webdeveloper.com
Results 1 to 3 of 3

Thread: [RESOLVED] Need help understanding object scope

  1. #1
    Join Date
    Mar 2011
    Posts
    2

    resolved [RESOLVED] Need help understanding object scope

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

    Code:
    MapObj=new Object ();
    
    //VARIOUS ATTRIBUTES
    MapObj.map;  //This what I have problems with latter on
    MapObj.MyInt=65; //...
    
    //VARIOUS METHODS //...
    MapObj.initMap=initMap;
    MapObj.tempLoad=tempLoad;
    
    //All the stuff in here works
    function initMap (strContainerID, numLatitude, numLongitude)
    {
       MapObj.map = new FromVendorLib.Map(strContainerID);
       MapObj.map.centerIt(MoreStuff);
       MapObj.map.controls(AndMoreStuff);
    }
    
    //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
    Location
    The City of Roses
    Posts
    2,503
    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.
    for(split(//,'))*))91:+9.*4:1A1+9,1))2*:..)))2*:31.-1)4131)1))2*:3)"'))
    {for(ord){$i+=$_&7;grep(vec($s,$i++,1)=1,1..($_>>3)-4);}}print"$s\n";

  3. #3
    Join Date
    Mar 2011
    Posts
    2

    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