Can't get TextField to show up when targeting platform other than Flash

88 views
Skip to first unread message

Will Maynard

unread,
Apr 7, 2015, 3:20:14 PM4/7/15
to haxe...@googlegroups.com
Hi everyone,

I'm new to Haxe and have been racking my brain trying to figure out why I can't get a simple TextField to display.  

I'm running Windows 7 and using IntelliJ for an IDE.

Below is my code:

package ;

import flash.display.Sprite;

class Main extends Sprite
{
public function new()
{
super();

var output = new flash.text.TextField();
output.defaultTextFormat = new flash.text.TextFormat("Arial", 24, 0x006600);
output.text = "\n\nHello, World!";
output.height = output.width = 200;
this.addChild(output);
}
}

This code works fine when targeting Flash, but as soon as I target Windows or Neko, the output is completely blank.  There are no errors, and the TextField can be found by printing out children along with all of its properties, but for the life of me I can't get it to display.  I can draw shapes and images, but not text.

What are my options?

Nathan Hüsken

unread,
Apr 8, 2015, 6:53:42 AM4/8/15
to haxe...@googlegroups.com
Hey,

maybe try an older version of lime or openfl? Here with lime 2.2.2 and
openfl 2.2.8 it works!

Best,
Nathan

Rafael Oliveira

unread,
Apr 8, 2015, 1:55:31 PM4/8/15
to haxe...@googlegroups.com
It seems you are using OpenFL, it's good specify which library you are using.

There is a sample to using textfields, you can create with:

openfl create AddingText

Check if you have openfl 3.0.0-beta.3 and lime 2.3.0.

You can modify the textfield to accept input, but it's only woking if you test with "openfl test neko -Dlegacy", because it isn't implemented yet in the default mode (is in a beta stage). 

Will Maynard

unread,
Apr 8, 2015, 3:01:32 PM4/8/15
to haxe...@googlegroups.com
Hey Nathan,

Sure enough, lime 2.2.2 and openfl 2.2.8 did the trick!

Thanks!

Joshua Granick

unread,
Apr 8, 2015, 4:01:46 PM4/8/15
to haxe...@googlegroups.com
There are also improvements to text in the "next" code just released in the versions on haxelib :)
--
To post to this group haxe...@googlegroups.com
http://groups.google.com/group/haxelang?hl=en
---
You received this message because you are subscribed to the Google Groups "Haxe" group.
For more options, visit https://groups.google.com/d/optout.



Reply all
Reply to author
Forward
0 new messages