<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" applicationComplete="init()" width="269" height="196" viewSourceURL="srcview/index.html">
    <mx:Script>
        <![CDATA[
            import mx.effects.AnimateProperty;
            import com.pricope.miti.sound.SoundChannelProxy;
            
            var mySound:Sound;
            var sndChannel:SoundChannelProxy = new SoundChannelProxy();
            
            public function init():void {
                mySound = new Sound(new URLRequest("http://miti.pricope.com/samples/sound/test.mp3"));
            }
            
            public function play():void {
                sndChannel.channel = mySound.play(0,1);
                sndChannel.volume = 0.5;
                playButton.enabled = false;
                
            }
            public function fade():void {
                var effect:AnimateProperty = new AnimateProperty(sndChannel);
                effect.fromValue = 0.3;
                effect.toValue = 1;
                effect.duration = 3000;
                effect.property = "volume";
                effect.play();
                
            }
            
            public function change():void {
                sndChannel.volume = volume.value;
            }
        ]]>
    </mx:Script>
    
    <mx:HSlider x="65" y="33" width="142" id="volume" maximum="1" minimum="0" value="{sndChannel.volume}" change="change()"/>
    <mx:Button x="97" y="10" label="AnimateEffect" click="fade()"/>
    <mx:Text x="10" y="40" text="Volume"/>
    <mx:Button x="10" y="10" label="Play" id="playButton" click="play()"/>
    
</mx:Application>