title: Accessing object in another javascript file
body: <p>I have two JS files</p>
  
  <p>Player.js where I create a Media</p>
  
  <pre><code>(function() {
  
  function Media(){
          this.url = "";
  }
  
  Media.prototype.setURL = function(url){
      this.url = url;
      alert("setURL="+this.url);
  }
  
  })();
  </code></pre>
  
  <p>Another file is Main.js where I access this Media as shown below</p>
  
  <pre><code>var media = new Media();
  Main.keyDown = function(){
      var keyCode = event.keyCode;
      alert("Key pressed: " + keyCode);
  
      switch(keyCode){
         case tvKey.KEY_1:
              alert("Key 1 pressed");
              media.setURL("1-link");
              break;
      }
  };
  </code></pre>
  
  <p>I have a index.html where I have included these scripts</p>
  
  <pre><code>&lt;script language="javascript" type="text/javascript" src="app/javascript/dash-player.js"&gt;&lt;/script&gt;
  &lt;script language="javascript" type="text/javascript" src="app/javascript/Main.js"&gt;&lt;/script&gt; 
  </code></pre>
  
  <p>The problem is that I am getting error while accessing this Media from Main.js as shown below</p>
  
  <pre><code>[JS ERROR]:
  File:           Main.js
  Line No:        3
  Error Detail:   ReferenceError: Can't find variable: Media
  </code></pre>
  
  <p>I have tried various things but since I am new to Javascript till now unable to get this resolved   </p>