SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Enthusiast
    Join Date
    Sep 2007
    Posts
    41
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Thumbs up how to know if my sound is playing or finished playing?

    I`m loading and playing sound like below.

    Code:
    //SOUND LOAD
    
    var snd:Sound = new Sound();
    snd.load(new URLRequest("sound.mp3"));
    snd.addEventListener(IOErrorEvent.IO_ERROR, onIOError, false, 0, true);
    snd.addEventListener(Event.COMPLETE, onSoundLoadComplete, false, 0, true);
    
    function onIOError(evt:IOErrorEvent):void{
    	trace("sound loading error: ",evt.text);
    }
    
    function onSoundLoadComplete(evt:Event):void{
    	trace("sound loaded");
    }
    
    //SOUND PLAY
    
    snd_btn1.addEventListener(MouseEvent.MOUSE_OVER,sndPlay);
    
    function sndPlay(evt:Event):void{
    	
    	var channel:SoundChannel
    	channel = snd.play(); 
    }
    i would like to have my sound to play only when it`s not already playing.
    how can I achieve this?

    thank you

  2. #2
    SitePoint Member KrisKringle's Avatar
    Join Date
    Sep 2008
    Posts
    10
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    http://livedocs.adobe.com/flash/9.0/...ndChannel.html - SoundChannel has a SOUND_COMPLETE event


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •