Create a Seek Bar for a Mp3 Sound File : Mp3 « Development « Flex






Create a Seek Bar for a Mp3 Sound File

Create a Seek Bar for a Mp3 Sound File
         

<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical">
    <mx:VBox width="400" height="300" creationComplete="loadSound()">
        <mx:Script>
            
    
                private var sound:Sound;
                private var chan:SoundChannel;
    
                private function loadSound():void {
                    sound = new Sound(new URLRequest("http://localhost/Plans.mp3"));
                    chan = sound.play();
                }
    
                private function scanPosition():void {
                    chan.stop();
                    chan = sound.play(positionSlider.value/10 * sound.length);
                }
    
                private function scanVolume():void{
                    var trans:SoundTransform = new SoundTransform(volumeSlider.value, (panSlider.value - 5)/10);
                    chan.soundTransform = trans;
                }
    
          
        </mx:Script>
        <mx:Label text="Position"/>
        <mx:HSlider change="scanPosition()" id="positionSlider"/>
        <mx:Label text="Volume"/>
        <mx:HSlider change="scanVolume()" id="volumeSlider"/>
        <mx:Label text="Pan"/>
        <mx:HSlider change="scanVolume()" id="panSlider"/>
    </mx:VBox>
</mx:Application>
    

   
    
    
    
    
    
    
    
    
  








Related examples in the same category

1.Play and Pause an MP3 FilePlay and Pause an MP3 File