• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Sound Function Doesn't work on TouchEvent

Participant ,
Oct 12, 2020 Oct 12, 2020

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);

 

 

TOPICS
ActionScript , Code

Views

324

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 12, 2020 Oct 12, 2020

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?

 

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Oct 12, 2020 Oct 12, 2020

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?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 12, 2020 Oct 12, 2020

Copy link to clipboard

Copied

you can't test any touch events in the emulator unless you enable a touch layer:

 

Screenshot - 10_12_2020 , 1_46_17 PM.png

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Oct 12, 2020 Oct 12, 2020

Copy link to clipboard

Copied

So when I publish an AIR for Android APK file the touch layer goes with it?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Oct 12, 2020 Oct 12, 2020

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 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 12, 2020 Oct 12, 2020

Copy link to clipboard

Copied

LATEST

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines