From 60c5991aa94d73ecb7a57629375d19ed1b98a954 Mon Sep 17 00:00:00 2001 From: Cameron Taylor Date: Fri, 31 Oct 2025 16:27:16 -0400 Subject: [PATCH 1/2] add onCharacterTyped signal in FlxTypeText which will dispatch when the character changes --- flixel/addons/text/FlxTypeText.hx | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/flixel/addons/text/FlxTypeText.hx b/flixel/addons/text/FlxTypeText.hx index 3af3592b..7217971e 100644 --- a/flixel/addons/text/FlxTypeText.hx +++ b/flixel/addons/text/FlxTypeText.hx @@ -12,6 +12,7 @@ import flixel.math.FlxMath; import flixel.system.FlxAssets; import flixel.text.FlxText; import flixel.sound.FlxSound; +import flixel.util.FlxSignal; import flixel.math.FlxRandom; import openfl.media.Sound; @@ -110,6 +111,8 @@ class FlxTypeText extends FlxText */ public var eraseCallback:Void->Void; + public var onCharacterTyped(default, never):FlxSignal = new FlxSignal(); + /** * The text that will ultimately be displayed. */ @@ -439,6 +442,8 @@ class FlxTypeText extends FlxText _length += Std.int(_timer / delay); if (_length > _finalText.length) _length = _finalText.length; + + onCharacterTyped.dispatch(); } if (_erasing && _timer >= eraseDelay) @@ -516,6 +521,7 @@ class FlxTypeText extends FlxText if (_length >= _finalText.length && _typing && !_waiting && !_erasing) { onComplete(); + onCharacterTyped.dispatch(); } // If we're done erasing, call the onErased() function From 62b38cb6823218f6ce8ec50ade8c3a224cda4ff2 Mon Sep 17 00:00:00 2001 From: Cameron Taylor Date: Tue, 4 Nov 2025 14:05:00 -0500 Subject: [PATCH 2/2] fixup! add onCharacterTyped signal in FlxTypeText which will dispatch when the character changes --- flixel/addons/text/FlxTypeText.hx | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/flixel/addons/text/FlxTypeText.hx b/flixel/addons/text/FlxTypeText.hx index 7217971e..7392cebd 100644 --- a/flixel/addons/text/FlxTypeText.hx +++ b/flixel/addons/text/FlxTypeText.hx @@ -13,6 +13,7 @@ import flixel.system.FlxAssets; import flixel.text.FlxText; import flixel.sound.FlxSound; import flixel.util.FlxSignal; +import flixel.util.FlxDestroyUtil; import flixel.math.FlxRandom; import openfl.media.Sound; @@ -111,7 +112,10 @@ class FlxTypeText extends FlxText */ public var eraseCallback:Void->Void; - public var onCharacterTyped(default, never):FlxSignal = new FlxSignal(); + /** + * Dispatches each time a character is typed. + */ + public final onCharacterTyped:FlxSignal = new FlxSignal(); /** * The text that will ultimately be displayed. @@ -560,4 +564,10 @@ class FlxTypeText extends FlxText _sound.loadEmbedded(new TypeSound()); #end } + + override public function destroy():Void + { + FlxDestroyUtil.destroy(onCharacterTyped); + super.destroy(); + } }