Skip to main content
Participating Frequently
April 15, 2015
Question

Object response is not in the same time as the object been hit

  • April 15, 2015
  • 2 replies
  • 518 views

Hi there, Im Paul from Malaysia. Currently i am creating an music instrument mobile app by using Adobe Flash CS6, using actionscript 3.0. In my app, there is an object that i need it to response as a button, once the object been hit(tap), the object can immediately release sound. I found this coding and i used it :

Multitouch.inputMode = MultitouchInputMode.TOUCH_POINT;

sound_btn.addEventListener(TouchEvent.TOUCH_TAP, f24_TapHandler);
function f24_TapHandler(event:TouchEvent):void

{

  var drum:MySound3 = new MySound3();

    var channel:SoundChannel = drum.play();

}

I had rendered swf to test the app and the object did response, but i found that the response quite slow as when i hit on the object, the object did not release sound at the same time. I thought it will be fine if test in mobile device, so i publish it to apk file and tested on my phone. Though the app can be function, but the same issue occur, and it much more slower than tested on my laptop. Is there any solution on this? Just one more step before the app complete, i hope i can made this stuff up. Thanks a lot.

This topic has been closed for replies.

2 replies

Inspiring
April 16, 2015

I would think some of your latency comes from the fact that you're instantiating the sound and a channel after the sound is clicked. You don't need the channel object unless you want to change volume or something, and it doesn't look like you are. I would try defining the sound outside of the function, and then just playing it.

var drumSound:Sound = new MySound3();

function f24_TapHandler(event:TouchEvent):void

{

drumSound.play();

}

Paul822Author
Participating Frequently
April 16, 2015

Hi dmennenoh,

Ya that's right the object doesnt need to change volume or something, What i just need is an instant sound after the object been hit. I had try the coding as you suggest for me but the results remain the same. Tested in my laptop there's about 0.2 sec latency(maybe), but when come to my mobile device, more worst.

kglad
Community Expert
Community Expert
April 15, 2015

check for white space at the start of your sound.

Paul822Author
Participating Frequently
April 16, 2015

Hi kglad,

You mean the space in front of "var channel:SoundChannel = drum.play();" ?

I do check it but the results still the same, nothing change. I wondering issit about file size issue? Total size of the app is about 11MB. Is it big size file will causing the malfunctioning of the app's execution?

kglad
Community Expert
Community Expert
April 16, 2015

no, open the sound file of the drum sound (with your ear or in audition) when the sound starts.