How do i introduce a Sound from the library to a ByteArray (and then play that ByteArray)?
I am working on a game, made with Flash (using AS3)
The game has a fast ball and when this ball hits an object it has to make a sound... but the sound starts with delay (so the ball is far away when the sound is played).
- This sound is edited by me and it hasn't got any silences at the beginning.
The method i'm currently using is the simplest开发者_JAVA技巧 one:
public var sonidoPuntos1:sonidopunto1 = new sonidopunto1()
and then...
sonidoPuntos1.play()
I am trying to introduce the file into a ByteArray and then playing it from there, as i've read in many forums that this makes the player start faster... but i'm clueless on how to do this. Any suggestion? Thanks a lot!
If you're using MP3 there are problems with the file format itself that cause delays at the beginning of the sound. Try using WAVs instead.
Have you tried checking if the audio file has a delay at the beginning? Also try putting in the starttime parameter in the Sound.play method, so that the sound starts not from the beginning but say 100ms in.
E.g. Sound.play(100) //The sound starts 100 ms in
精彩评论