Copy link to clipboard
Copied
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);
Copy link to clipboard
Copied
i'm not sure what the emoticon is doing in taphandler but a right paran colon (in the code panel) wouldn't cause that. and there's no closing curly bracket for taphandler().
those both may still be forum artifacts so do you see any compiler errors in animate?
if not, do you see your textfield respond?
if not and no, do you add a touch layer in the emulator?
Copy link to clipboard
Copied
a right paran colon was there in the original code. somehow it didn't copy over when I did copy and paste. the emoji was produced automatically by this site NOT by me.
I do not get an error message. The sound just doesn't work in the Android emulator but works under Animate tests when I use a mouse event.
how do I add touch layer in the emulator?
Copy link to clipboard
Copied
you can't test any touch events in the emulator unless you enable a touch layer:
Copy link to clipboard
Copied
So when I publish an AIR for Android APK file the touch layer goes with it?
Copy link to clipboard
Copied
Following with your advice I found out that It works with Adobe Animate emulator but not with the Android Studio emulator
Copy link to clipboard
Copied
i've never used the android studio emulator. (in general, i've had trouble doing anything useful with android studio.)
you don't need a touch layer when testing on touch devices and i strongly suggest you all your testing on a device, not an emulator.