English 中文(简体)
Flash / actionscript 3 sound delay
原标题:

Im working on a flash project where I am loading multiple sounds from external files. The problem is that when I play them within my project there is a small delay from when they should be played until they are actually playing.

My sounds are very short and are loaded before the project is actually using them. I have looked up the problem online and it looks like the problem is not something that is only happening for me. But, non of the resources I found had any clear ways of fixing this.

Some resources say that you can fix this my constantly having a sound playing in the background. I have that but it does not help. I have also looked at the actual sound file in a sound tool and there is a small delay before the sound starts, but it is very very small and should not result in the delay im seeing in my flash project.

Does anyone know of a good way to fix it?

问题回答

Hi guys I had the same problem I had the delay before playing sond, the delay is of about 500ms, maybe 300. I tried wav files also but the same I tried to play swf from folder and the delay seem to be not anymore. It seems that the delay is present only when playing from CS4 program after compiling. If playing not from program, but opening swf file with an standalone player, the delay seem to be gone...

How noticeable is the delay? If this is a synchronization problem, are you open to maybe delaying the movie a very small amount until the sound starts playing? That way at least things will be in synch. If this is okay, read on:

How are you playing the sounds? If you are playing them via AS3, there is a simple way to check when a sound is fully loaded. Suppose your sound is called mySound . Add an event listener to it which fires once the sound is fully loaded:

mySound.addEventListener(Event.COMPLETE,eventHandler);

Then, start playing your movie in the event handler:

function eventHandler(e:Event)
{
    play();
}

That way, your movie will only start playing once the sound has been loaded.

I had the same issue. Download the latest update for Flash CS4.... the sound problem has been fixed among other things. http://blogs.adobe.com/rgalvan/2009/05/flash_cs4_update_now_available.html hope it helps

I think you are suffering from the silence that is added to the beginning of a sound by the MP3 codec. It adds whatever amount makes the compression work best for each file and can vary quite a bit. You need to open your MP3 files in an editor and measure the offset to the actual start of the sound and then provide that value to the play() method as the startTime.





相关问题
Playing a Sound With Monotouch

No matter what I try (build -> content, NSUrl, filename) I get a null exception : file not found when I try to play a .caf sound file in monotouch. //var path = NSBundle.MainBundle.PathForResource("...

将音频Clips从Peter改为服务器

我不禁要问,那里是否有任何实例表明从Peit向服务器发送音响。 I m不关心电话或SIP风格的解决办法,只是一个简单的袖珍流程......

Play sound in iPhone web app with Javascript?

I m currently creating an iPhone web application for piano chords, and I wanted to add an option that would let the user press a Play button and play the selected chord. However, I m not sure how to ...

热门标签