Muting FLVPlayback Component by default
So the other day a friend of mine asked me if I’d ever needed to set an FLVPlayback component to start with the volume muted (and the mute icon set to muted). I hadn’t, but I got thinking about it and after a little research found the easiest way to go about it is to extend the FLVPlayback class and add the functionality yourself.
There are two parts to this. Firstly, we need to create the custom class. As you can see from the code below, all this needs to do is import the necessary classes and extend the FLVPlayback component. Then all I’ve done is added a setter so that you can choose whether or not you want to start the FLVPlayback component “muted”.
package {
import fl.video.UIManager;
import fl.video.flvplayback_internal;
import fl.video.FLVPlayback;
use namespace flvplayback_internal;
public class ExtendedFLVPlayback extends FLVPlayback {
public function ExtendedFLVPlayback() {
super();
}
public function set startMuted(v:Boolean):void{
if(v) this.uiMgr.dispatchMessage(UIManager.MUTE_ON_BUTTON);
}
}
}
Secondly, we need to create an instance of the player so we can actually use it. All we need to do here is create an instance of the ExtendedFLVPlayback component, give it a skin, and then set it to “startMuted”. Finally, give it a source to load in and add it to the stage.
var foo:ExtendedFLVPlayback = new ExtendedFLVPlayback();
foo.skin = “SkinOverPlayMute.swf”;
foo.startMuted = true;
foo.source = “someFLV.flv”;
addChild(foo);
There are a few things to note here. Firstly, you’ll need to have a copy of the FLVPlayback component in your library. Secondly, you’ll need to include a skin SWF. You can find the generic Flash ones in your Flash application folder under Common > Configuration > FLVPlayback Skins > Actionscript 3.0.
That’s about it – hopefully it helps someone out there. These little things that aren’t native settings can be a pain but with a little tweaking they’re easy to get over.
You can download the source files here (CS4 and CS3).
*UPDATE* – I’ve included a CS3 FLA in the ZIP file as well now.
Enjoy,
Jassa
Tags: AS3, Flash, FLVPlayback, mute, video

August 25, 2009
Can you save the native docs down to CS3 please!!!!
August 25, 2009
@Patrick I’ve updated the ZIP file in the post to include a CS3 FLA as well – you’ll just need to download the ZIP again.
October 2, 2009
Just wanted to let you know that this method did exactly what I wanted it to. Thank you very much
March 16, 2010
WoW. I am speechless… you ROCK. I hope this goes far and wide, you deserve it.
July 11, 2010
All the previous solutions didn’t work for me.
Here’s what I did.
I put this code in frame one of my file.
My instance of FLVPlayback is called myVid so just replace myVid with the name that you gave your FLVPlayback instance.
import fl.video.flvplayback_internal;
use namespace flvplayback_internal;
myVid.uiMgr.dispatchMessage(UIManager.MUTE_ON_BUTTON);