I need to allow users to select a file from their machine in an html5 game. Unfortunately, sys.Filesystem isn’t available on html5, and lime.ui.FileDialog doesn’t support loading files on html5 yet. I found this set of examples, and tried the Browse.hx example. I confirmed using jsfiddle that (minus the intermingled Haxe code) it does indeed add the filebrowser. I tested it in Firefox and Chrome and neither had a problem. However, when using the example in my app, it works perfectly in Chrome but not in Firefox.
Using the Firefox dev console I was able to determine that the input element is indeed created and added, but its type is “hidden”, not “file”, and its id is just and empty string. I tried adding the element before setting attributes, after setting attributes, setting attributes by getting the element from the DOM, and nothing I tried worked in Firefox. The element’s attributes just can’t be set. I understand the security implications of programmatically sending clicks like this, but since the element isn’t even being setup properly, it seems like this is a different issue.
Am I missing something obvious? Is there a better way to give the user a file dialog on html5?