[windows] text display vanishes after removeChild with openFL 8.5.1 and lime 7.1.1

on windows target (c++) if you create a TextField with some text, add it to stage, remove it and then add it again the text isn’t displayed anymore.

You then can set TextField.text to make it appear again

The issue doesn’t happen when using openFL 8.4.1 and lime 7.0.0
It also works fine on flash and html5 targets using openFL 8.5.1 and lime 7.1.1

Here is a small test which shows the issue (make sure your background is not black or you won’t see the text)

import openfl.display.Sprite;
import openfl.Lib;
import openfl.events.MouseEvent;
import openfl.text.TextField;

/**
 * ...
 * @author Matse
 */
class Main extends Sprite 
{
	private var _text:TextField;
	
	public function new() 
	{
		super();
		
		// Assets:
		// openfl.Assets.getBitmapData("img/assetname.jpg");
		
		_text = new TextField();
		_text.text = "this is just a test";
		addChild(_text);
		
		stage.addEventListener(MouseEvent.MOUSE_UP, onClick);
	}
	
	/**
	   
	   @param	evt
	**/
	private function onClick(evt:MouseEvent):Void
	{
		if (_text.parent == null)
		{
			addChild(_text);
		}
		else
		{
			removeChild(_text);
		}
	}

}

Awesome! Thanks for the test! Fixed on dev :success:

1 Like