Hi,
 
Flash Player can only load and play only MP3 file(sound format) on runtime. Flash Player can also load other formats FLV, JPEG, SWF files.
 
Why don't you convert your WAV file to MP3 and then use Sound object to load & play in Flex. But this approach would load(or stream) sound and might take some time...
 
To play sound on a event like mouseOver or click, you can embed sound in the application itself. You will be assured that sound would play as soon as user interacts.
 
Following code  straight from docs, is a way to embed sound in your application:
 
<mx:Application xmlns:mx="http://www.macromedia.com/2003/mxml">
   <mx:Script>
      <![CDATA[
         //Create global variable.
         var snd:Sound;

         //Use Embed metadata keyword to point to resource.
         [Embed(yoursound.mp3')]
         //Declare global variable for the symbol.
         var soundSymbol:String;

         function startSound() {
            //Declare instance of Sound.
            snd = new Sound;
            //Attach sound symbol.
            snd.attachSound(soundSymbol);
            snd.start();
         }

         function stopSound() {
            snd.stop();
         }

      ]]>
   </mx:Script>

   <mx:VBox>
      <mx:Button label="Start" id="b1" mouseOver="startSound();" mouseOut="stopSound()"/>
   </mx:VBox>
</mx:Application>
 
-abdul

From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of [EMAIL PROTECTED]
Sent: Friday, June 10, 2005 12:30 AM
To: [email protected]
Subject: [flexcoders] Can you attach a wav file to a flex application

How do you set it so that a wav file is played when you move the mouse over a button?

Yahoo! Groups Links

Reply via email to