title: Three.js - accessing a child object in a scene
body: <p>I'm trying to access the child object <code>sole</code> in a scene. I am able to access the var <code>sole</code> inside the loader function using <code>obj</code>, but I need to access it from outside the loader function.</p>
  
  <p><a href="http://deepplanet.com/fiddlejs/2/" rel="nofollow">Here's the working code</a> and 
  <a href="http://deepplanet.com/fiddlejs/2/models/shoe4.json" rel="nofollow">here's the json model file</a>.</p>
  
  <p>I can access it from inside the loader, like this:</p>
  
  <pre><code>var loader = new THREE.ObjectLoader();  
  loader.load("models/shoe4.json", function (obj) {
      scene.add (obj);
      scene.rotation.y = Math.PI/1;
      scene.position.y = -5;
      scene.position.z = -24;
  
      var sole = obj.getObjectByName( "sole", true );
      sole.position.y = -5;
  
  });
  </code></pre>
  
  <p>But I need to do something like this:</p>
  
  <pre><code>var loader = new THREE.ObjectLoader();  
  loader.load("models/shoe4.json", function (obj) {
      scene.add (obj);
      scene.rotation.y = Math.PI/1;
      scene.position.y = -5;
      scene.position.z = -24;     
  });
  
  var sole = obj.getObjectByName( "sole", true );
  sole.position.y = -5;
  </code></pre>
  
  <p>Basically I need to put it it's own function for later use. </p>
  
  <p>I also tried</p>
  
  <pre><code>var sole = scene.getObjectByName( "sole", true );
  sole.position.y = -5;
  </code></pre>
  
  <p>Which gave me the error :</p>
  
  <blockquote>
    <p>Uncaught TypeError: Cannot read property '<code>getObjectByName</code>' of undefined</p>
  </blockquote>
  
  <p>How do I access the object <code>sole</code> from anywhere? Simply declaring <code>var obj,</code> is not working.</p>