lpbr 2 Posted February 22, 2018 Report 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! Quote Link to post Share on other sites
samme 722 Posted February 22, 2018 Report Share Posted February 22, 2018 onInputUp should work. Also see examples/v2/input/group-input-events examples/v2/input/input-enable-group lpbr 1 Quote Link to post Share on other sites
lpbr 2 Posted February 22, 2018 Author Report 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! Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.