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

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

New Here ,
Apr 14, 2015 Apr 14, 2015

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.

TOPICS
ActionScript
433
Translate
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 ,
Apr 15, 2015 Apr 15, 2015

check for white space at the start of your sound.

Translate
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
New Here ,
Apr 15, 2015 Apr 15, 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?

Translate
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 ,
Apr 15, 2015 Apr 15, 2015

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

Translate
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
New Here ,
Apr 16, 2015 Apr 16, 2015

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.

Translate
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 ,
Apr 16, 2015 Apr 16, 2015

use a mousedown handler with capture enabled and retest.

Translate
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
New Here ,
Apr 16, 2015 Apr 16, 2015

Hi kglad,

You mean change the app to mouseClick-enabled and use mouse event and retest?

Translate
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 ,
Apr 16, 2015 Apr 16, 2015

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.

Translate
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
New Here ,
Apr 17, 2015 Apr 17, 2015

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.

Translate
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 ,
Apr 17, 2015 Apr 17, 2015

use MouseEvent.MOUSE_DOWN

Translate
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
New Here ,
Apr 18, 2015 Apr 18, 2015
LATEST

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.

Translate
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
Enthusiast ,
Apr 16, 2015 Apr 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();

}

Translate
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
New Here ,
Apr 16, 2015 Apr 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.

Translate
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