SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Enthusiast
    Join Date
    Aug 2009
    Posts
    27
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Why won't this (d*m) sound play?

    This sound traces that it loads and plays; but I don't hear a thing. The intention is to use it for a button click sound. I tryed an mp4 as well, I prepared the sound in iMovie and exported it.

    Any Ideas?

    var sndReady:Boolean = false; //tells us sound is not read
    var needleSound:Sound = new Sound();
    needleSound.load(new URLRequest("assets/needle.wav"));
    needleSound.addEventListener(Event.COMPLETE,sndLoaded);

    function sndLoaded(evt:Event):void{
    trace("sound has loaded");
    var trans:SoundTransform = new SoundTransform(0.6, -1);
    var channel:SoundChannel = needleSound.play(0, 1, trans);
    trace("sound has played");
    sndReady = true; // tells us sound is ready
    needleSound.removeEventListener(Event.COMPLETE,sndLoaded);
    }

  2. #2
    Community Advisor silver trophy

    Join Date
    Nov 2006
    Location
    UK
    Posts
    2,554
    Mentioned
    40 Post(s)
    Tagged
    1 Thread(s)
    Because you can't dynamically load wavs. Use an mp3 instead (and use a smapling frequency of 44/22 or 11khz)

  3. #3
    SitePoint Enthusiast
    Join Date
    Aug 2009
    Posts
    27
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    That was it. I used iTunes to convert the wav file into an mp3

    something like this:
    with the wav file selected in itunes:
    /preferences/general/import settings/import using:mp3 encoder/OK


Tags for this Thread

Bookmarks

Posting Permissions

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