Development Flex


    
        
            
                import mx.collections.ArrayCollection;
    
                public var sound:Sound;
                public var mySoundChannel:SoundChannel;
                public var pausePos:int = 0;
    
                private function loadSound():void {
                    sound = new Sound();
                    sound.addEventListener(Event.SOUND_COMPLETE, soundComplete);
                    var req:URLRequest = new URLRequest("http://localhost/a.mp3");
                    sound.load(req);
                    pausePos = 0;
                    mySoundChannel = sound.play();
                }
                private function soundComplete(event:Event):void {
                    sound.load(new URLRequest("http://localhost/a.mp3"));
                    mySoundChannel = sound.play();
                }
    
                private function playPauseHandler():void{
                    if(pausePlayBtn.selected){
                        pausePos = mySoundChannel.position;
                        mySoundChannel.stop();
                    } else {
                        mySoundChannel = sound.play(pausePos);
                    }
                }