Hey guys, I’ve got a tiled map in Json format and I see there is a Haxe API for importing these things, however I cant figure it out. I simply want to read in a text file and get access to the “data”.
Heres what I’ve attempted that doesnt work:
var mp = sys.io.File.getContent(‘map/tiles.json’);
var myObject = haxe.Json.parse(mp);
Which throws me this error:
> Called from ? line 1
Called from ApplicationMain.hx line 139 Called from ApplicationMain.hx line 26 Called from lime/app/Preloader.hx line 58 Called from openfl/display/Preloader.hx line 93 Called from NMEPreloader.hx line 107 Called from openfl/events/EventDispatcher.hx line 95 Called from openfl/display/DisplayObject.hx line 270 Called from a C function Called from openfl/events/EventDispatcher.hx line 237 Called from openfl/display/Preloader.hx line 129 Called from a C function Called from lime/app/Preloader.hx line 242 Called from lime/app/Event.hx line 141 Called from ApplicationMain.hx line 83 Called from ApplicationMain.hx line 165 Called from a C function Called from Main.hx line 105 Called from openfl/display/DisplayObjectContainer.hx line 59 Called from openfl/display/DisplayObjectContainer.hx line 787 Called from openfl/display/DisplayObject.hx line 270 Called from a C function Called from openfl/events/EventDispatcher.hx line 237 Called from Main.hx line 96 Called from Main.hx line 42 Called from /usr/lib/haxe/std/neko/_std/sys/io/File.hx line 30 Uncaught exception - [file_contents,map/tiles.json]
I’ve use the “exists” function,exists(“img/tiles.png”)==true), and can see the file exists.