Search code examples
functionaframeconflict

A-frame: onclick function conflict?


I'm working in a scene with several assets that brings text on screen when clicked. I used for this a component called "texto-html". Then I added an introduction screen with a start button, with its own js file ("boton-intro.js"). After I added this, the first assets stop working. Could it be a conflict between onclick functions?

This is the link to the project: https://glitch.com/edit/#!/join/48b5ad79-1824-4fe6-a8c3-151c52c108fc
(It is all in Spanish).


Solution

  • You had an unclosed <script> tag where the texto-html component was defined

    <script>
    <script>
    // somewhere near line 12 of index.html
    AFRAME.registerComponent('texto-html', 
    ...
    )
    </script>
    

    When the file was parsed, the compiler threw an error

    Unexpected token <

    when it got to the second script tag. Once removed, you can press the buttons, and different divs pop up.