Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
check for white space at the start of your sound.
Copy link to clipboard
Copied
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?
Copy link to clipboard
Copied
no, open the sound file of the drum sound (with your ear or in audition) when the sound starts.
Copy link to clipboard
Copied
Hi kglad,
ya i do checked the sound file and i am sure the sound file has no problem because i had edited the audio length as short as possible.
Copy link to clipboard
Copied
use a mousedown handler with capture enabled and retest.
Copy link to clipboard
Copied
Hi kglad,
You mean change the app to mouseClick-enabled and use mouse event and retest?
Copy link to clipboard
Copied
yes, or you could test to see if there's an immediate visual change when you tap. that would confirm there's a sound problem and not a touch problem.
Copy link to clipboard
Copied
hi kglad,
I had tested the app by using mousedown event and it is working with mouse Click event. Then i tested with multitouch event with Tap again,
i realize that when i click on the object ( mouse down) , it doesnt release the sound, but when i release the mouse click ( mouse up), the sound released instantly. I couldnt find any coding for multitouch event which can capture the "tap down" input.
Copy link to clipboard
Copied
use MouseEvent.MOUSE_DOWN
Copy link to clipboard
Copied
Hi kglad,
I had tried test the app by using MouseEvent.MOUSE_DOWN and it is fine when tested on laptop using mouse. When come to use touch pad on laptop, the apps doesnt catch the input instantly and latency still occur. Then i try tested on my mobile device, as what i figure out, the latency still happened. I realize that the touch input doesnt captured by the apps instantly and it always response after tapping event.
Copy link to clipboard
Copied
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();
}
Copy link to clipboard
Copied
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.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now