The following example shows how you can mute the volume on a Spark VideoPlayer control in Flex Gumbo by setting the Boolean muted property.
Full code after the jump.
To use the following code, you must have Flash Player 10 and a Flex Gumbo SDK installed in your Flex Builder 3. For more information on downloading and installing the Gumbo SDK into Flex Builder 3, see “Using the beta Gumbo SDK in Flex Builder 3″.
<?xml version="1.0" encoding="utf-8"?>
<!-- http://blog.flexexamples.com/2009/05/05/muting-the-volume-on-a-spark-videoplayer-control-in-flex-gumbo/ -->
<s:Application name="Spark_VideoPlayer_muted_test"
xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/halo">
<s:CheckBox id="checkBox"
label="muted"
left="10"
top="10" />
<s:VideoPlayer id="videoPlayer"
source="http://helpexamples.com/flash/video/cuepoints.flv"
muted="{checkBox.selected}"
horizontalCenter="0"
verticalCenter="0" />
</s:Application>
View source is enabled in the following example.
You can also set the muted property using ActionScript, as seen in the following example:
<?xml version="1.0" encoding="utf-8"?>
<!-- http://blog.flexexamples.com/2009/05/05/muting-the-volume-on-a-spark-videoplayer-control-in-flex-gumbo/ -->
<s:Application name="Spark_VideoPlayer_muted_test"
xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/halo">
<s:CheckBox id="checkBox"
label="muted"
left="10"
top="10"
click="videoPlayer.muted = checkBox.selected;" />
<s:VideoPlayer id="videoPlayer"
source="http://helpexamples.com/flash/video/cuepoints.flv"
horizontalCenter="0"
verticalCenter="0" />
</s:Application>
This entry is based on a beta version of the Flex Gumbo SDK and therefore is very likely to change as development of the Flex SDK continues. The API can (and will) change causing examples to possibly not compile in newer versions of the Flex Gumbo SDK.
