This should do the trick (tested in a frame on the root timeline, no class needed) import flash.media.Sound; import flash.media.SoundTransform; import flash.events.MouseEvent; import flash.media.SoundChannel; import flash.display.MovieClip; var current:int = 0; var songs:Array = new Array(new ExportedForActionScriptDotWav(), new SecondDotMp3(), new ThirdDotWav()); var st:SoundTransform = new SoundTransform(); var chan:SoundChannel = songs[current].play(current, int.MAX_VALUE, st); function prepare(mc:MovieClip) { mc.addEventListener(MouseEvent.CLICK, clickResponse); mc.buttonMode = true; //change mouse cursor on hover to the hand version and makes tab work for selection } prepare(movieClipNamedVolUp); prepare(movieClipNamedVolDown); prepare(movieClipNamedNextSong); prepare(movieClipNamedStopAll); function clickResponse(me:MouseEvent) { if (me.target.name=="movieClipNamedVolUp") { volumeChange(1.2, 0.01); //precision increase } else if (me.target.name=="movieClipNamedVolDown") { volumeChange(0.8, -0.1); //quick decrease } else if (me.target.name=="movieClipNamedNextSong") { chan.stop(); current++; if (current==songs.length) { current = 0; } chan = songs[current].play(0, int.MAX_VALUE, st); } else if (me.target.name=="movieClipNamedStopAll") { SoundMixer.stopAll(); current--; //will replay current song when next is clicked if (current<0) { current = songs.length-1; } } } function volumeChange(multiplier:Number, steadyAmount:Number) { st.volume = Math.max(0, Math.min(1, st.volume*multiplier+steadyAmount)); chan.soundTransform = st; } |