Trouble loading Sound

I can’t get Sound to load a small mp3 file. I’ve done this plenty in AS3 Air projects. I’ve looked really hard for stupid mistakes but I must be missing something. I am using HaxeDevelop and targeting “windows” currently using “Debug”.

Can anyone help?

Here is the program.


import openfl.display.Sprite;
import openfl.Lib;
import openfl.utils.Timer;
import sys.FileSystem;

 * ...
 * @author Bruce
class Main extends Sprite 

	private			var	_treePlantManySound		:Sound;
	private			var _treePlantManySoundTrans:SoundTransform;
	private			var _treePlanManytSoundChan	:SoundChannel;
	private 		var _repeatTimer			:Timer;
	private 		var _theSoundURLRequest		:URLRequest;
	public function new() 
		_repeatTimer	= new Timer(5000, 0);
		_repeatTimer.addEventListener(TimerEvent.TIMER, playItAgain, false);
		trace("FileSystem.exists()	= " + FileSystem.exists("../../Audio/A/SoundDogs_Audio/testsound.mp3")); 
		_theSoundURLRequest			= new URLRequest("../../Audio/A/SoundDogs_Audio/testsound.mp3");
		trace("_theSoundURLRequest.url	= " + _theSoundURLRequest.url);
		//_treePlantManySound			= new Sound(_theSoundURLRequest);
		_treePlantManySound			= new Sound();
		_treePlantManySound.addEventListener(IOErrorEvent.IO_ERROR, handleIOErrors, false);
		_treePlantManySoundTrans	= new SoundTransform(1);
	private function playItAgain(event	:TimerEvent):Void
		trace("bytes loaded  = " + _treePlantManySound.bytesLoaded);
		_treePlanManytSoundChan		=, 2, _treePlantManySoundTrans);
	private function handleIOErrors(event	:IOErrorEvent):Void
		trace("handleIOErrors()			event target = " +;
		trace("handleIOErrors()			event current target = " + event.currentTarget);
		trace("handleIOErrors()			event text = " + event.text);
		trace("handleIOErrors()			event toString() = " + event.toString());
		trace("handleIOErrors()			event = " + event);

Here is the output:

Running process: C:\HaxeToolkit\haxe\haxelib.exe run lime run “project.xml” windows -debug -notrace
src/Main.hx:36: FileSystem.exists() = true
src/Main.hx:38: _theSoundURLRequest.url = …/…/Audio/A/SoundDogs_Audio/testsound.mp3
src/Main.hx:54: handleIOErrors() event target = [object Sound]
src/Main.hx:55: handleIOErrors() event current target = [object Sound]
src/Main.hx:56: handleIOErrors() event text =
src/Main.hx:57: handleIOErrors() event toString() = [IOErrorEvent type=“ioError” bubbles=true cancelable=false text="" errorID=0]
src/Main.hx:58: handleIOErrors() event = [IOErrorEvent type=“ioError” bubbles=true cancelable=false text="" errorID=0]
src/Main.hx:48: bytes loaded = 0
src/Main.hx:48: bytes loaded = 0
src/Main.hx:48: bytes loaded = 0

Haxe Develop says my SDK is “Haxe 4.1.1”

Here is what haxelib says:

C:\Users\BBartonSr>haxelib list
actuate: [1.8.9]
box2d: [1.2.3]
hxcpp: [4.2.1]
layout: [1.2.1]
lime-samples: [7.0.0]
lime: [7.8.0]
nme: [6.1.1]
openfl-samples: [8.7.0]
openfl: [9.0.2]
polygonal-printf: [1.0.2-beta]

Any suggestions?

Thank you.

As far as I know, MP3 decoding is not yet supported by Lime on Windows target (but it works on Flash or HTML5 targets, for example). You should try OGG format instead.

I have had okay results with WAV in the past also. Note that not all codecs are equal.

Thank you @tour1st and @Confidant. OGG worked.

I guess I haven’t been use open source long enough for it to even dawn on me that the MP3 format might not be supported.

I found this in OpenFl’s issue section on GitHub

Is the lack of information in the dispatched IOErrorEvent an issue that I should submit?