Setting the volume on an FLVPlayback component in Flash using ActionScript 3.0

by Peter deHaan on December 22, 2008

in FLVPlayback

The following example shows how you can set the volume level on a Flash ActionScript 3.0 FLVPlayback control by setting the volume property.

Full code after the jump.

// ActionScript 3.0
/* Requires:
 * - Button component in Flash library
 * - Slider component in Flash library
 * - FLVPlayback component in Flash library
 */
import fl.controls.Button;
import fl.controls.Slider;
import fl.events.SliderEvent;
import fl.video.FLVPlayback;
 
var button:Button = new Button();
button.label = "Play";
button.addEventListener(MouseEvent.CLICK, button_click);
button.move(10, 10);
addChild(button);
 
var slider:Slider = new Slider();
slider.minimum = 0.0;
slider.maximum = 1.0;
slider.value = 1.0;
slider.tickInterval = 0.1;
slider.snapInterval = 0.01;
slider.liveDragging = true;
slider.addEventListener(SliderEvent.CHANGE, slider_change);
slider.move(120, 20);
addChild(slider);
 
var flvPlayback:FLVPlayback = new FLVPlayback();
flvPlayback.autoPlay = false;
flvPlayback.source = "http://www.helpexamples.com/flash/video/cuepoints.flv";
flvPlayback.x = 10;
flvPlayback.y = 40;
addChild(flvPlayback);
 
function button_click(evt:Event):void {
    flvPlayback.stop();
    flvPlayback.seek(0);
    flvPlayback.play();
}
 
function slider_change(evt:SliderEvent):void {
    flvPlayback.volume = evt.value;
}

{ 2 comments… read them below or add one }

1 silky 02.01.10 at 4:16 pm

Do you have any FLV sample for this As3?

2 Peter deHaan 02.01.10 at 4:28 pm

@silky,

You can download the FLV from http://helpexamples.com/flash/video/cuepoints.flv

Peter

Leave a Comment

You can use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="">

Previous post:

Next post: