Revision: 12002
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at February 26, 2009 18:37 by Ktoso
Initial Code
var maxMove:Number =50; var bounds:Rectangle = new Rectangle(this.volumeSlider.x, this.volumeSlider.y, -maxMove, 0); var scrolling:Boolean = false; function startScroll (e:Event):void { scrolling = true; this.volumeSlider.startDrag (false,bounds); } function stopScroll (e:Event):void { scrolling = false; this.volumeSlider.stopDrag (); } function enterHandler (e:Event):void { if (scrolling == true) { MovieClip(this.root).setVolume(1-((bounds.x-this.volumeSlider.x)/maxMove)); } } function setVolume(vol:Number){ var mod:SoundTransform = new SoundTransform(); mod.volume = vol; mp3Channel.soundTransform = mod; //apply to yout mp3Channel } addEventListener (Event.ENTER_FRAME, enterHandler); this.volumeSlider.addEventListener (MouseEvent.MOUSE_DOWN, startScroll); stage.addEventListener (MouseEvent.MOUSE_UP, stopScroll);
Initial URL
http://www.project13.pl
Initial Description
Simple yet effective way to create a horizontal slider to controll the volume of your sound channel
Initial Title
AS3 Volume Slider
Initial Tags
script, flash, 3
Initial Language
ActionScript 3