From 49598c52c9515e9fb118a2d3a6430f87e8a94318 Mon Sep 17 00:00:00 2001 From: George Kurelic Date: Fri, 21 Jan 2022 11:51:35 -0800 Subject: [PATCH] Enable FileBrowse on HTML5. (#288) (#291) * Works now on html5. * Update PlayState.hx Importing from openfl for both flash and html5 targets, since openfl and flash imports are interchangeable. Co-authored-by: Vasco Freitas --- UserInterface/FileBrowse/source/PlayState.hx | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/UserInterface/FileBrowse/source/PlayState.hx b/UserInterface/FileBrowse/source/PlayState.hx index f39da9456..9ecec2ef4 100644 --- a/UserInterface/FileBrowse/source/PlayState.hx +++ b/UserInterface/FileBrowse/source/PlayState.hx @@ -12,11 +12,11 @@ import flixel.ui.FlxButton; import flixel.util.FlxColor; import flixel.math.FlxMath; import flixel.system.FlxAssets; -#if flash -import flash.display.Loader; -import flash.display.LoaderInfo; -import flash.net.FileReference; -import flash.net.FileFilter; +#if (flash || html5) +import openfl.display.Loader; +import openfl.display.LoaderInfo; +import openfl.net.FileReference; +import openfl.net.FileFilter; #elseif (sys && !hl) import systools.Dialogs; #end @@ -139,7 +139,7 @@ class PlayState extends FlxState function _showFileDialog():Void { - #if flash + #if (flash || html5) var fr:FileReference = new FileReference(); fr.addEventListener(Event.SELECT, _onSelect, false, 0, true); fr.addEventListener(Event.CANCEL, _onCancel, false, 0, true); @@ -159,7 +159,7 @@ class PlayState extends FlxState #end } - #if flash + #if (flash || html5) function _onSelect(E:Event):Void { var fr:FileReference = cast(E.target, FileReference);