# Update objects after add to scene

**URL:** <https://discourse.threejs.org/t/update-objects-after-add-to-scene/2347>\
**Category:** Questions\
**Tags:** loaders\
**Created:** [April 5, 2018, 4:48pm UTC](https://discourse.threejs.org/t/update-objects-after-add-to-scene/2347 "2018-04-05T16:48:50Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![jramos](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/jramos/32/1406_2.png) [@jramos](https://discourse.threejs.org/u/jramos)\
**Post date:** [April 5, 2018, 4:48pm UTC](https://discourse.threejs.org/t/update-objects-after-add-to-scene/2347/1 "2018-04-05T16:48:50Z")

</div>

Hi,

Now I have a bucle for which add objects to a scene:

```auto
for (var i = 0; i < DEMOS.length; i++) {
            var geometry = new THREE.PlaneGeometry(1.5 * SCALE, 1 * SCALE);
            var texture = loader.load('url');
            var material = new THREE.MeshBasicMaterial({map: texture});
            var plane = new THREE.Mesh(geometry, material);
            plane.position.x = positions[i][0]
            plane.position.y = positions[i][1]
            plane.position.z = positions[i][2]

            plane.lookAt(camera.position);
            scene.add(plane)
        }

```

I would like to update this objects when a asyncronous event be fired, for example to change the image of the texture I have to save this obj into an array?

Thanks

---

<div class="post-metadata">

**Author:** ![Mugen87](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/mugen87/32/5645_2.png) [@Mugen87](https://discourse.threejs.org/u/Mugen87)\
**Post date:** [April 5, 2018, 4:51pm UTC](https://discourse.threejs.org/t/update-objects-after-add-to-scene/2347/2 "2018-04-05T16:51:56Z")

</div>

Use the `onLoad` callback:

```javascript
var texture = loader.load( 'url', function() {

    scene.add( plane );

} );

```

BTW: With a little research effort, you can answer this question by yourself 😉

---

<div class="post-metadata">

**Author:** ![jramos](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/jramos/32/1406_2.png) [@jramos](https://discourse.threejs.org/u/jramos)\
**Post date:** [April 5, 2018, 5:08pm UTC](https://discourse.threejs.org/t/update-objects-after-add-to-scene/2347/3 "2018-04-05T17:08:32Z")

</div>

This response is for this message or for the other question? 😉

---

<div class="post-metadata">

**Author:** ![Mugen87](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/mugen87/32/5645_2.png) [@Mugen87](https://discourse.threejs.org/u/Mugen87)\
**Post date:** [April 5, 2018, 5:13pm UTC](https://discourse.threejs.org/t/update-objects-after-add-to-scene/2347/4 "2018-04-05T17:13:34Z")

</div>

This one I guess 😊

---

<div class="post-metadata">

**Author:** ![jramos](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/jramos/32/1406_2.png) [@jramos](https://discourse.threejs.org/u/jramos)\
**Post date:** [April 6, 2018, 7:17am UTC](https://discourse.threejs.org/t/update-objects-after-add-to-scene/2347/5 "2018-04-06T07:17:48Z")

</div>

I think that this answer is to this question, no?

> [@TextureLoader with external image link CORS](https://discourse.threejs.org/t/textureloader-with-external-image-link-cors/2343/8):
>
> Is posible to make transparent the plane until the image is loaded?. Now the plane is black

How helps, add the object in the callback to be able to edit the objects after been added?

Thanks 😉

---

<div class="post-metadata">

**Author:** ![Mugen87](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/mugen87/32/5645_2.png) [@Mugen87](https://discourse.threejs.org/u/Mugen87)\
**Post date:** [April 6, 2018, 10:14am UTC](https://discourse.threejs.org/t/update-objects-after-add-to-scene/2347/6 "2018-04-06T10:14:44Z")

</div>

Oh you’re right, sry. But changing objects afterwards using callbacks or event listener is no big deal. You are using ordinary JavaScript features for this. Have a look at the official examples to see some code samples.

Besides, the following manual page describes `three.js` specific things you have to care about:

[https://threejs.org/docs/index.html#manual/introduction/How-to-update-things](https://threejs.org/docs/index.html#manual/introduction/How-to-update-things)

---

<div class="post-metadata">

**Author:** ![jramos](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/jramos/32/1406_2.png) [@jramos](https://discourse.threejs.org/u/jramos)\
**Post date:** [April 6, 2018, 11:05am UTC](https://discourse.threejs.org/t/update-objects-after-add-to-scene/2347/7 "2018-04-06T11:05:45Z")

</div>

Thanks, needsToUpdate was the key.

Sorry for my noob questions but sometimes I don’t know what search or where is the key to search.

Thanks again
