[HTML5] Filters are not correclty updated on text change



Please, test with htmlText too:

import openfl.display.Sprite;
import openfl.filters.GlowFilter;
import openfl.text.TextField;
import openfl.text.TextFormat;

class Main extends Sprite {
	public function new () {
		super ();
		//var format = new TextFormat ("_sans", 40, 0xFF0000);
		var textField = new TextField ();
		textField.width = 600;
		textField.htmlText = "<font face='_sans' size='40' color='#FFFF00'>Click<font color='#FF0000'> her</font>e please!</font>";
		/*format.color = 0x4D0404;
		textField.setTextFormat(format, 0, 5);
		format.color = 0xCE4400;
		textField.setTextFormat(format, 5, 9);
		format.color = 0x4D0404;
		textField.setTextFormat(format, 9, textField.length);
		textField.filters = [new GlowFilter(0xFFFF00, 1)];*/
		addChild (textField);
		stage.addEventListener ("click", function (_) {
			textField.htmlText = "Thank you!";


Yup that works too. The fix is for text that contains multiple formats after a space, so I need to make sure that normal text after a space still works.


I pushed it to dev. Hopefully it doesn’t break anything, but let me know if it does :slight_smile:


Thanks, I’ll report any suspicious behavior :slight_smile:


There’s another issues with <font color> tag for multiline texts:


I have a PR out for the second issue, just to get any feedback people might have. The change itself is pretty straightforward.


I have another bug to report related to texts and filters in HTML5.

When changing scrollRect of a Sprite which has a TextField child with filters, it’s position is not updated properly.

I recorded 2 videos:
Scrolling of text without filter: https://youtu.be/yOsA_OdUoo4
Scrolling of text with filter (bugged): https://youtu.be/Qyas7kwc9R0

What we have is:

  1. Sprite containter
  2. 2nd Sprite container as it’s child
  3. TextField as a child of 2nd Sprite container
  4. GlowFilter which is applied to the TextField on mouse over
    For the bug to occur we change scrollRect property of the 2nd sprite container (I use wheel scrolling in the video), while the cursor is over the TextField (for the filter to be applied).


Would you mind trying OpenFL 8.8, which was released yesterday? It has fixes related to scrollRect changes


Tried with OpenFL 8.8 - all the same.


Yep, I see the bug. Would it be possible for someone to write a small sample that reproduces this problem? Using mouse scrolling is fine, though it would be even better if it occurred on mouse over or enter frame