lpbr Posted February 22, 2018 Share Posted February 22, 2018 I have this simple game for small children that consists on several images that when tapped should produce a sound. I got it working on the computer (mouse click) but not on mobiles (finger tap) and I suspect that's because I am listening to the wrong event. Could someone tell me how to listen to a image "tap"? My current working code for computers is: // I am adding the functions and listeners dynamically with a // loop so aAssets is an array containing the image elements // enable input window[aAssets[i]].inputEnabled = true; // create the function to be triggered by the listener window['lst'+aAssets[i]] = function (me) { alert (me.key); } // add the respective listener window[aAssets[i]].events.onInputDown.add(window['lst'+aAssets[i]], this); PS: I found the events "onDown" and "onTap" and tried them but both causes an error when added. Thanks! Link to comment Share on other sites More sharing options...
samme Posted February 22, 2018 Share Posted February 22, 2018 onInputUp should work. Also see examples/v2/input/group-input-events examples/v2/input/input-enable-group lpbr 1 Link to comment Share on other sites More sharing options...
lpbr Posted February 22, 2018 Author Share Posted February 22, 2018 1 minute ago, samme said: onInputUp should work. Also see examples/v2/input/group-input-events examples/v2/input/input-enable-group Thank you very much, samme! "onInputUp" did the trick! Link to comment Share on other sites More sharing options...
Recommended Posts