The Sound Effect plays an mp3 file when you perform an event. You will use the source property for specify the mp3 file.
The Sound Effect plays an mp3 file when you perform an event. You will use the source property for specify the mp3 file.The Sound Effect plays an mp3 file when you perform an
event. You will use the source property for specify the mp3 file. The tag of
Sound Effect is <mx:SoundEffect>. The syntax is following:
<mx:SoundEffect
id="ID"
autoLoad="true|false"
bufferTime="1000"
loops="0"
panEasingFunction=""
panFrom="0"
source=""
startTime="0"
useDuration="true|false"
volumeEasingFunction="true|false"
volumeTo="1"/>
In this example you can see how we can use a Sound Effect in your application.
<?xml version="1.0" encoding="utf-8"?> <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600"> <fx:Declarations> <mx:SoundEffect id="mp3sound" source="@Embed(source='file:/C:/work/bikrant/mp3/Best_Guitar_Tone_201.mp3')" useDuration="false" loops="0"/> </fx:Declarations> <s:Panel title="MX Sound Effect Example" width="487" height="228" chromeColor="#000000" color="#CCCCCC"> <mx:ApplicationControlBar width="485" horizontalAlign="center"> <s:Label text="Click on image and show the effect." fontFamily="verdana" color="#000000"/> </mx:ApplicationControlBar> <mx:Image id="roseindia" source="@Embed(source='file:/C:/work/bikrant/image/player.png')" x="179" y="44" mouseDownEffect="{mp3sound}" width="128" height="128"/> </s:Panel> </s:Application> |
To view this page ensure that Adobe Flash Player version 10.0.0 or greater is installed.