Get assets from an absolute url?

After using OpenFL and Haxe for several years I am surprised that I’ve never encountered this issue before:

I need to be able to serve my assets from a url that is not relative to the hosting page’s url.

E.g. If my game is at

then I need my assets to be somewhere other than

, say,


I think this may be possible by switching from Assets.getXXX to Assets.loadXXX methods, but that would require rewriting much of the current logic of my game to handle the futures.

This is for a client for whom I am trying to finish swiftly, so I wondered if there is a quicker way.

Many thanks

I guess another way to ask it is: can I still do preloading of assets that are found outside the serving page’s hierarchy? And if so, how do I tell OpenFL about that preference?

I have asked the client if they are able to insert a symlink from assets/ to /storage/games/my-game/assets/ but they may not be able to depending upon their hosting environment.

Try adding rootPath to your lime.embed call:


lime.embed ("::APP_FILE::", "openfl-content", ::WIN_WIDTH::, ::WIN_HEIGHT::, { rootPath: "/storage/", parameters: {} });

You can override the standard template by creating “templates/html5/template/index.html” (with your own modified copy) and adding <template path="templates" /> to your project.xml :slight_smile:

Woo hoo brilliant, thanks a million!

To anybody else who stumbles upon this solution, here is what I did:

lime.embed("MyApp","openfl-content",0,0, {paramters: {}, rootPath:'/path/to/my/root/'});

where my top-level assets directory is /path/to/my/root/assets.

The app also had embedded fonts, so I altered the src fields in my <style> element accordingly