title: Aframe Texture Change
body: <p>I am working on the following script. To change the image of the .glb model. It producing only a white color. No proper texture change is happening. Please help me.</p>
  
  <pre class="lang-js prettyprint-override"><code>    const nextButtonComponent = () =&gt; ({          
    init: function() {
      const model = document.getElementById('model')
      const nextButton = document.getElementById('nextbutton')
      const loader = new THREE.TextureLoader();
  
      var material = new THREE.MeshStandardMaterial({
        side: THREE.DoubleSide,
        flatShading: true,
      });
      const mesh = model.getObject3D('mesh');
  
      nextButton.style.display = 'block';
  
      const nextAnimation = () =&gt; {
        loader.load( './assets/img/1.jpg' ,
              function(texture){
              material.map = texture;
              material.needsUpdate = true;
  
              if(mesh){
                  mesh.traverse((node) =&gt; {
                    if (node.isMesh) {
                      node.material = material;
                      node.material.map = texture;
                      node.material.needsUpdate = true;
                    }
                  });
                }
              });
      }
      nextButton.onclick = nextAnimation // Switch to the next animation when the button is pressed.
    }
  })
  export {nextButtonComponent}
  </code></pre>