Passing parameters to HTML5 Lime/OpenFL application?

I’ve seen this topic discussed a couple of times, but I can’t seem to find a definitive answer. I’ve got an OpenFL app running in a web page. How can I embed parameters on the page to pass to the app at startup time? A couple of years ago it was possible to set winParameters(), which could then be read via Lib.current.loaderInfo.parameters, but this doesn’t seem to be working anymore. Any advice?

Ideally, it would be possible to embed the app multiple times on the same page, each time with different parameters, but a bit of searching around suggests that this is impossible. Is that still the case?

Thanks.

I recently got something similar to work, though I did it by making four versions of index.html (1 2 3 4) rather than changing the embed parameters.

If you look at the source of each HTML file, you’ll see that the only difference is that each one has a different function call after lime.embed(). Those functions are all Haxe functions, made available to JavaScript using the expose metadata.

@:keep @:expose("layoutdemo.noScale")
public static function noScale():Void {
    scale = NO_SCALE;
}
1 Like