A Flash Developer Resource Site

Results 1 to 5 of 5

Thread: Background sound not playing

  1. #1
    Junior Member
    Join Date
    May 2006
    Posts
    21

    Background sound not playing

    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:

    Code:
    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:

    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>

  2. #2
    Senior Member cancerinform's Avatar
    Join Date
    Mar 2002
    Location
    press the picture...
    Posts
    13,448
    The problem is that your swf is in a folder. Where is the bomb.mp3 located? The path to the mp3 is not correct.
    - The right of the People to create Flash movies shall not be infringed. -

  3. #3
    Junior Member
    Join Date
    May 2006
    Posts
    21
    bomb.mp3 is located in the folder bomb with bomb.swf

  4. #4
    Senior Member cancerinform's Avatar
    Join Date
    Mar 2002
    Location
    press the picture...
    Posts
    13,448
    Then probably you need to change to this

    URLRequest("bomb/bomb.mp3");
    - The right of the People to create Flash movies shall not be infringed. -

  5. #5
    Junior Member
    Join Date
    May 2006
    Posts
    21
    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center