Sound Function Doesn't work on TouchEvent

41 Views Asked by At

When I'm trying to add a sound to TouchEvent Function the sound doesn't work on the Android emulator. But it works fine if I replace the TouchEvent with MouseEvent and test it on Adobe Animate. What am I doing wrong?

Multitouch.inputMode = MultitouchInputMode.TOUCH_POINT;
var mysound: ClickTap = new ClickTap();
var mySprite: Sprite = new Sprite();
var myTextField: TextField = new TextField();
mySprite.graphics.beginFill(0x336699);
mySprite.graphics.drawRect(0, 0, 40, 40);
addChild(mySprite);
mySprite.addEventListener(TouchEvent.TOUCH_TAP, taphandler);

function taphandler(evt: TouchEvent): void {

    mysound.play();
    myTextField.text = "I've been tapped";
    myTextField.y = 50;
    addChild(myTextField);
0

There are 0 best solutions below