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.

Variable wont reset, or i cant cancel-go outside a on event of click

Home Forums Puzzles Variable wont reset, or i cant cancel-go outside a on event of click

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #64838
    Jeff Boone
    Customer

    Hey yall, so am having a very strange and annoying problem. I will try the explain everything very simple

    So I have a menu with 2 buttons. You click button 1 and you load gltfNo1. When gltfNo1 is loaded I display a new Animbutton. The Animbutton plays a different animation each time you click it. First click you play anim1, second click you play anim2, etc until anim7.
    While you act these animated sequence steps, you can click another button to go to menu, and load gtlfNo2 or reload gltfNo1

    SO whats the problem:
    if you quit the animate sequence mid way (if you wont finish all steps) by clicking the go home button, and then you load either gltfNo1 or gltfNo2 you will play anim1 and anim2 in the same by click the Animbutton once. After anim1 and anim 2 are played, if you click Animbutton once you play anim3 and anim4 at these same time. ALSO if you go home now, and select either gltfNo1 or glftNo2, and then click the Animbutton once you will play anim1 anim2 and anim3 at the same time.
    etc etc etc and you will reach a point where you play the whole anim sequence of 7 total anims, by just one click. :cry: :cry: :cry:

    I am resetting the step_coount each time you click the go home button. Also I tried resetting it each time you will the load gltf, but same problem exist. What the heck is going on??? Let me know if you need any photos or code parts from the XML or images. Thaks so much!

    #64839
    kdv
    Participant

    Just show your puzzles.

    Most likely you created that wierd logic without debugging. And that’s the problem. Use the “print to console” puzzle to control every step…

    Puzzles and JS. Fast and expensive.

    If you don’t see the meaning in something it primarily means that you just don’t see it but not the absence of meaning at all.

    #64847
    Jeff Boone
    Customer

    Hey! Thanks for posting! here are the most important parts:

    Attachments:
    You must be logged in to view attached files.
    #64852
    kdv
    Participant

    Here is you problem:

    You create the same event listener for the same button every time you load .gltf. As a result you have several event listeneres working at once. Never do this way. Move that bunch of puzzles out. You need only one.

    Puzzles and JS. Fast and expensive.

    If you don’t see the meaning in something it primarily means that you just don’t see it but not the absence of meaning at all.

    #64855
    Jeff Boone
    Customer

    OH MYYY
    Thanks so much! So am unloading the gltf, but that doesn’t mean much right? The listener still exist correct?

    So will remove the big on event puzzle out of the when loaded slot, and place them under the VehicleHighView puzzle?

    well I will make a function and use it 4 times for each if loop

    #64856
    kdv
    Participant

    Just place that puzzle somewhere separately. It doesn’t need to be inside some function. It’s an event listener for a specified HTML element, not an action.

    Puzzles and JS. Fast and expensive.

    If you don’t see the meaning in something it primarily means that you just don’t see it but not the absence of meaning at all.

    #64857
    Jeff Boone
    Customer

    Now its works. Thanks men! :heart: :heart: :heart: :heart:

    • This reply was modified 10 months, 3 weeks ago by Jeff Boone.
Viewing 7 posts - 1 through 7 (of 7 total)
  • You must be logged in to reply to this topic.