Skip to content

Commit

Permalink
Enable FileBrowse on HTML5. (HaxeFlixel#288) (HaxeFlixel#291)
Browse files Browse the repository at this point in the history
* 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 <[email protected]>
  • Loading branch information
2 people authored and ninjamuffin99 committed Mar 10, 2022
1 parent 1ca48a0 commit 49598c5
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions UserInterface/FileBrowse/source/PlayState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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);
Expand All @@ -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);
Expand Down

0 comments on commit 49598c5

Please sign in to comment.