Assets.loadSound complete handler never triggers

it loads sound but onComplete handler never triggers

path : [africa/audio/RegularWinSnd.mp3],
valTxt : RegularWinSnd,
type : aud,
progPersent : null,
loaders : [{
isComplete : true,
value : [object Sound]
}]

found an answer my self
in load sound function this code is missing
if (handler != null) {

				promise.future.onComplete (handler);
				
			}

wtf?

Hello,

Thank you for bringing this to our attention. The handler callbacks in openfl.utils.Assets were intended to be deprecated (and removed) in an older version of OpenFL, but this didn’t happen. I’ve just fixed this in our GIT repository, so both the handler callback that was missing (as you mentioned) as well as deprecation in a future version of OpenFL occur :slight_smile:

Without changing to a development version, you should be able to use the callbacks returned by the lime.app.Future instance:

Assets.loadSound ("sound.ogg").onComplete (handler);

The Future is better than the original handler because it allows you to get progress and error callbacks as well :slight_smile:

1 Like