From c5740735233f94864dd56188185b4ca8ac42a115 Mon Sep 17 00:00:00 2001 From: Jaime Humberto Macias Bustamante Date: Mon, 4 Mar 2024 09:18:06 -0700 Subject: [PATCH] OpenFL version compatibility fix (reopen) (#250) * OpenFL version compatibility fix Uses var alias "__source" on 9.2.2 or "__audioSource" on latest, in case of using latest libraries. * Revert "OpenFL version compatibility fix" This reverts commit aa83aee5a5c5eb3f4e7645187f7223e438786439. * OpenFL Compatibility fix Uses (compiles) "__source" or "__audioSource" variable depending of the OpenFL version, in order to not break FlxSound. * Revert "OpenFL Compatibility fix" This reverts commit 18a9aeddf984da22422ee6f24efb9b61060456de. * OpenFL compatibility fix (get/set var) (suggestion by @NeeEoo) uses an auxiliary "__audioSource" variable for usage on latest OpenFL versions, in order to not break FlxSound class. --- source/openfl/media/SoundChannel.hx | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/source/openfl/media/SoundChannel.hx b/source/openfl/media/SoundChannel.hx index f74d89b6..0838f391 100644 --- a/source/openfl/media/SoundChannel.hx +++ b/source/openfl/media/SoundChannel.hx @@ -64,6 +64,7 @@ import lime.media.AudioSource; @:noCompletion private var __soundTransform:SoundTransform; #if lime @:noCompletion private var __source:AudioSource; + @:noCompletion private var __audioSource(get, set):AudioSource; #end #if openfljs @@ -232,6 +233,14 @@ import lime.media.AudioSource; __dispose(); dispatchEvent(new Event(Event.SOUND_COMPLETE)); } + + function set___audioSource(value:AudioSource):AudioSource { + return __source = value; + } + + function get___audioSource():AudioSource { + return __source; + } } #else typedef SoundChannel = flash.media.SoundChannel;