Quick noob question about loading sounds

Hello OpenFL community,

I have this code:

import openfl.Assets;
import openfl.media.Sound;
var sound:Sound;
sound = Assets.loadSound(name);

And I get these compiler errors on the last line:
lime.app.Future<openfl.media.Sound> should be openfl.media.Sound
lime.app.Future<openfl.media.Sound> should be flash.media.Sound

What’s up with that?

loadSound() doesn’t give you your Sound object immediately. Instead, it starts loading your sound and lets you know as soon as it’s done. Since it returns a Future object, you can register a listener with onComplete().

If you’re including your sound assets normally, then you don’t have to wait. Just replace loadSound() with getSound(), and it’ll return your sound immediately.

Ok, that was simple enough. :blush: Thanks!