Skip to content

Instantly share code, notes, and snippets.

@jgranick
Created February 7, 2012 20:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jgranick/1761798 to your computer and use it in GitHub Desktop.
Save jgranick/1761798 to your computer and use it in GitHub Desktop.
How to play a sound (NME recipe)
import nme.display.Sprite;
import nme.media.Sound;
import nme.Assets;
/**
* @author Joshua Granick
*/
class PlayingSound extends Sprite {
public function new () {
super ();
var sound = Assets.getSound ("assets/music/VIC68231.mp3");
sound.play ();
}
}
@MatthijsKamstra
Copy link

shouldn't this be:

var sound:Sound = nme.Assets.getSound ("assets/music/VIC68231.mp3");
sound.play ();

@jgranick
Copy link
Author

jgranick commented Jun 8, 2012

Sorry, hadn't updated it in a while :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment