He estado tratando de ejecutar este bucle con onEvents dentro, pero parece que no funciona. Puedo hacer clic en el botón y todo funciona, el ciclo while interno sigue repitiéndose hasta que se activa un onEvent, pero ninguno de los onEvents se activa cuando hago clic en ellos.
onEvent("startBtn", "click", function() { setScreen("songScreen"); setText("songName1", "Song name: " + trackName[0]); setText("artistName1", "Artist name: " + artistName[0]); setText("pos1", "Song position: " + songPos[0]); setText("pop1", "Song popularity: " + songPop[0]); while (i < songPos.length) { setText("songName1", "Song name: " + trackName[i]); setText("artistName1", "Artist name: " + artistName[i]); setText("pos1", "Song position: " + songPos[i]); setText("pop1", "Song popularity: " + songPop[i]); upClick(); downClick(); } }); function upClick() { onEvent("upImg", "click", function() { songLiked = true; console.log("test up"); i++; }); } function downClick() { onEvent("downImg", "click", function() { songLiked = false; console.log("test down"); i++; }); }¿Qué estoy haciendo mal?