SKITSANOS FOR RIA

Skitsanos

Friday, May 16, 2008

Play Sound Samples From One File Using ActionScript 3

As you start to develop applications more often you learn ways to save time. One common way to work with sound is to load in many clips and use whatever one you need at the time, or import them into the library during the authoring process. Both of these approaches work in most case, but do have limitations. For instance, loading the sound into the library means you can't update the sounds without republishing the entire movie. The second option, loading in the sounds at runtime works better but means some sort of loading manager is needed and takes longer.

Of course I wouldn't have written an article if there was only two ways to work with sound in ActionScript, because you probably already knew about those.

The third option for working with sound it to load in one sound file (mp3) and only play a portion of it, depending on which sound you want to play. As you noticed in the attached example, I have loaded a family guy sample where each button plays a certain portion of the sample. The idea of this approach is to minimize the loading process and make it easier to update.

To determine the specific point to play the file from I recommend using Soundbooth or a similar sound editor. In sounbooth it clearly displays the current time which makes it very easy to work with

Full article...

0 comments:

Webware development dedicated blog by Skitsanos R&D Labs. ASP.NET, XML, RIA, Adobe Flex, ActionScript 3, AIR, AJAX, Web 2.0, Backbase, CGI development with RealBasic and other web development issues.
News
Downloads