diff --git a/source/funkin/game/cutscenes/VideoCutscene.hx b/source/funkin/game/cutscenes/VideoCutscene.hx index f979376f77..ea75b3b078 100644 --- a/source/funkin/game/cutscenes/VideoCutscene.hx +++ b/source/funkin/game/cutscenes/VideoCutscene.hx @@ -25,7 +25,7 @@ class VideoCutscene extends Cutscene { var localPath:String; #if VIDEO_CUTSCENES - var video:FlxVideoSprite; + final video:FlxVideoSprite = new FlxVideoSprite(); final mutex = new sys.thread.Mutex(); var cutsceneCamera:FlxCamera; @@ -58,17 +58,20 @@ class VideoCutscene extends Cutscene { parseSubtitles(); - add(video = new FlxVideoSprite()); video.antialiasing = true; - video.bitmap.onEndReached.add(close); - video.bitmap.onFormatSetup.add(function() if (video.bitmap != null && video.bitmap.bitmapData != null) { - final width = video.bitmap.bitmapData.width; - final height = video.bitmap.bitmapData.height; - final scale:Float = Math.min(FlxG.width / width, FlxG.height / height); - video.setGraphicSize(width * scale, height * scale); - video.updateHitbox(); - video.screenCenter(); + video.bitmap.onFormatSetup.add(function() { + if (video.bitmap != null && video.bitmap.bitmapData != null) { + final width = video.bitmap.bitmapData.width; + final height = video.bitmap.bitmapData.height; + final scale:Float = Math.min(FlxG.width / width, FlxG.height / height); + + video.setGraphicSize(width * scale, height * scale); + video.updateHitbox(); + video.screenCenter(); + } }); + video.bitmap.onEndReached.add(close); + add(video); //cover = new FlxSprite(0, FlxG.height * 0.85).makeSolid(FlxG.width + 50, FlxG.height + 50, 0xFF000000); //cover.scrollFactor.set(0, 0);