We use cookies to ensure that we give you the best experience on our website. If you continue to use this site we will assume that you are happy with it.

JS Function on appended scene object

Home Forums Puzzles JS Function on appended scene object

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #18781
    mexwann
    Customer

    Hi,

    I am trying to apply a JS function to objects from appended scenes. But it seems to not working, only with object of the original scene.

    Here is the JS function example:
    app.ExternalInterface.removeObject = function(objName) {
    var obj = app.scene.getObjectByName(objName);
    app.scene.remove(obj);
    }

    And attached a picture of the puzzle example.

    I am sure it is no big deal to do this, but I can’t :wacko: … Any help would great.

    #18791

    Hi,

    you can use the puzzles when clicked – all object only once. Also does it work for one-scene case (when you don’t use append scene)?

    Chief 3D Verger | LinkedIn | Twitter

    #18896
    mexwann
    Customer

    Thanks Yuri for helping. It does work for a one scene only case.

    Only issue for objects from appended scene (with the when clicked – all object puzzle out of the procedure to not repeat).

    #18901

    Hi,

    can you attach your project files for us to look into?

    Chief 3D Verger | LinkedIn | Twitter

    #18936
    mexwann
    Customer

    Here are the files. Thanks a lot!

    #18948

    Hi,

    Dynamically loaded objects are added in sub-scenes parented to the main scene. So the code will be slightly different:

    
        app.ExternalInterface.removeObject = function(objName) {
            var obj = app.scene.getObjectByName(objName);
            obj.parent.remove(obj);
        }

    P.S. I think we need a remove object puzzle.

    Attachments:
    You must be logged in to view attached files.

    Chief 3D Verger | LinkedIn | Twitter

    #18986
    mexwann
    Customer

    Thanks a lot! Working great. Indeed, I think a remove puzzle would be a great addition.

    #18993

    you’re welcome! we’ll think about remove object. :)

    Chief 3D Verger | LinkedIn | Twitter

Viewing 8 posts - 1 through 8 (of 8 total)
  • You must be logged in to reply to this topic.