Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Is there an event listener in AS3 for when a sound file has finished playing?

Posted on 2009-06-30
1
Medium Priority
?
856 Views
Last Modified: 2013-11-11
Hi, I'm making a slow and painful transition from AS2 to AS3, and moreover I've never done much work with sound.  In any case I have a project where sound files will be loaded into the movie and played.  After certain files are finished playing, I want to control some movies or remove them all together from the stage.  All of this isn't a problem, except I haven't found an event listener for when a sound file finishes playing.  I have seen the "complete" event in the livedocs, but this appears to be when the file finishes loading -- not necessarily done playing.  Do I have to start timers or something?  Thanks in advance for help.  
0
Comment
Question by:Xerc
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 18

Accepted Solution

by:
Antonio Estrada earned 2000 total points
ID: 24757705
There is, try the following:

<code>

-V
var mySoundChannel:SoundChannel = new SoundChannel();
var mySound:Sound = new Sound();
 
mySound.load(new URLRequest("some_file.mp3"));
mySoundChannel = mySound.play();
mySoundChannel.addEventListener(Event.SOUND_COMPLETE, soundComplete);
 
function soundComplete(event:Event):void {
  trace("done!");
}

Open in new window

0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In my long career of working as an actionscript developer, I had spent sleepless night often working hard to solve some small problems which actually took a lot of my development time; later found out the solutions to be a line or two. Here are s…
The last time I worked with Flash and Socket connections was in AS1. A recent project required flash connecting to a Socket, and sending receiving information - we figured it would be easy enough - we all know about the socket policy documents and c…
In this tutorial viewers will learn how to create a basic shape tween animation in Flash including shape hints for smooth animation Open a new document in Flash: Draw a shape: Select another frame (how long you want the tween to be): Right click and…
The goal of the tutorial is to teach the user how to use the auto adjust feature and what the different options do. When your video is not working right you can choose the auto adjust feature to help choose your settings.
Suggested Courses

609 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question