-
Notifications
You must be signed in to change notification settings - Fork 366
Open
Description
Hi! I'm developing a game using Haxe/Heaps.io targeting web. Having trouble loading images dynamically.
Current setup:
- File exists at res/avatars/1.png
- Build config has -D resourcesPath=.../res
- File gets copied to bin/web/debug/res/avatars/1.png during build
Loading code:
// Option 1 - throws haxe_ValueException
var tile = hxd.Res.load("avatars/1.png").toTile();
var bitmap = new h2d.Bitmap(tile, parent);
// Option 2 - also doesn't work
var tile = hxd.Res.loader.load("avatars/1.png").toTile();
Console error:
Uncaught haxe_ValueException
What works:
- Static resources via hxd.Res.game.phone.toTile() (file at res/game/phone.png)
- HTML/CSS approach for displaying images
Questions:
- What's the correct way to load images dynamically by path in Heaps for web?
- Do resources need to be registered somewhere before use?
- What's the difference between hxd.Res.load() and hxd.Res.loader.load()?
Any help appreciated!

Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels