diff --git a/src/hxcodec/flixel/FlxVideo.hx b/src/hxcodec/flixel/FlxVideo.hx index 73f313e68..beaf8fa8a 100644 --- a/src/hxcodec/flixel/FlxVideo.hx +++ b/src/hxcodec/flixel/FlxVideo.hx @@ -5,6 +5,7 @@ import flixel.FlxG; import hxcodec.openfl.Video; import openfl.events.Event; import sys.FileSystem; +import openfl.utils.Assets; class FlxVideo extends Video { @@ -39,7 +40,9 @@ class FlxVideo extends Video FlxG.stage.addEventListener(Event.ENTER_FRAME, onEnterFrame); - if (FileSystem.exists(Sys.getCwd() + location)) + if (Assets.exists(location)) + return super.play(Assets.getPath(location), shouldLoop); + else if (FileSystem.exists(Sys.getCwd() + location)) return super.play(Sys.getCwd() + location, shouldLoop); else return super.play(location, shouldLoop); diff --git a/src/hxcodec/flixel/FlxVideoBackdrop.hx b/src/hxcodec/flixel/FlxVideoBackdrop.hx index 3c32f2a2d..34c372d16 100644 --- a/src/hxcodec/flixel/FlxVideoBackdrop.hx +++ b/src/hxcodec/flixel/FlxVideoBackdrop.hx @@ -4,10 +4,11 @@ package hxcodec.flixel; #if (!flixel_addons && macro) #error 'Your project must use flixel-addons in order to use this class.' #end - + import flixel.FlxG; import flixel.util.FlxAxes; import flixel.addons.display.FlxBackdrop; +import openfl.utils.Assets; import sys.FileSystem; import hxcodec.openfl.Video; @@ -53,10 +54,12 @@ class FlxVideoBackdrop extends FlxBackdrop if (bitmap != null) { - if (FileSystem.exists(Sys.getCwd() + location)) + if (Assets.exists(location)) + return bitmap.play(Assets.getPath(location), shouldLoop); + else if (FileSystem.exists(Sys.getCwd() + location)) return bitmap.play(Sys.getCwd() + location, shouldLoop); - - return bitmap.play(location, shouldLoop); + else + return bitmap.play(location, shouldLoop); } return -1; diff --git a/src/hxcodec/flixel/FlxVideoSprite.hx b/src/hxcodec/flixel/FlxVideoSprite.hx index 000ae5fa3..5f4198adc 100644 --- a/src/hxcodec/flixel/FlxVideoSprite.hx +++ b/src/hxcodec/flixel/FlxVideoSprite.hx @@ -4,6 +4,7 @@ package hxcodec.flixel; import flixel.FlxG; import flixel.FlxSprite; import flixel.util.FlxColor; +import openfl.utils.Assets; import sys.FileSystem; import hxcodec.openfl.Video; @@ -50,7 +51,9 @@ class FlxVideoSprite extends FlxSprite if (bitmap != null) { - if (FileSystem.exists(Sys.getCwd() + location)) + if (Assets.exists(location)) + return bitmap.play(Assets.getPath(location), shouldLoop); + else if (FileSystem.exists(Sys.getCwd() + location)) return bitmap.play(Sys.getCwd() + location, shouldLoop); else return bitmap.play(location, shouldLoop);