dimanche 22 janvier 2017

ActionScript 3.0 sound not working

So having trouble making sound on keyboard press

I have the imports:

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

I have the variables

private var soundDownRequest:URLRequest = new URLRequest ("SoundDown.mp3");
private var downSound:Sound = new Sound (soundDownRequest);

and the event listener

private function keyDownHandler(evt:KeyboardEvent):void
    {

            if (evt.keyCode == 40)//ascii for down arrow 
            {
                downSound.play();

            }
    }

The sound folder is in the same folder as the .as, its also in the library of the fla, yet it still doesn't work. Any idea why?

Thank you.

Aucun commentaire:

Enregistrer un commentaire