;

PDA

Click to See Complete Forum and Search --> : Background sound not playing


ben_stilwell
07-01-2009, 07:44 AM
I've got a game I made just to play with AS3. But I'm having an issue with the sound.

Playing the swf file will play the sound, but when embedded I hear nothing.

The code for calling the sound:

import flash.media.SoundMixer;
SoundMixer.stopAll();

import flash.media.Sound;
import flash.media.SoundLoaderContext;
import flash.net.URLRequest;

var s:Sound = new Sound();
var req:URLRequest = new URLRequest("bomb.mp3");
var context:SoundLoaderContext = new SoundLoaderContext(8000, true);
s.load(req, context);
s.play(0,1000);

The embed code:

<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=10,0,0,0" width="550" height="400" id="bomb" align="middle">

<param name="allowScriptAccess" value="sameDomain" />
<param name="allowFullScreen" value="false" />
<param name="movie" value="bomb/bomb.swf" />
<param name="quality" value="high" />
<embed src="bomb/bomb.swf" quality="high" width="550" height="400" name="bomb" align="middle" allowScriptAccess="sameDomain" allowFullScreen="false" type="application/x-shockwave-flash" pluginspage="http://www.adobe.com/go/getflashplayer" />
</object>

cancerinform
07-01-2009, 10:54 AM
The problem is that your swf is in a folder. Where is the bomb.mp3 located? The path to the mp3 is not correct.

ben_stilwell
07-01-2009, 11:40 AM
bomb.mp3 is located in the folder bomb with bomb.swf

cancerinform
07-01-2009, 01:29 PM
Then probably you need to change to this

URLRequest("bomb/bomb.mp3");

ben_stilwell
07-01-2009, 02:56 PM
I had changed it and it still wasn't working. So I moved the mp3 file up a directory and it worked fine. I'm not sure why it didn't work with bomb/bomb.mp3

thanks