I’m new to Haxe and openfl, coming from as3. I’m trying to simply show text with textfield but when i build and run on android i don’t get text. It works fine for html5 and flash.
Here is the code to create the textfield.
If you are using FlashDevelop, click in the target drop-down and type “android -Dlegacy”, it should add it as an additional option on the list for you.
If you use the command-prompt or terminal, try “openfl test android -Dlegacy”
Hi i’m new to Haxe (but i really like it!) and have similar problem on ios. I use IntelliJ as my IDE and i’m compiling project directly from it. Just tried compile with -Dlegacy using Terminal but no luck, any suggestions ? By the way it works on Android
libs:
Haxe: 3.1.3
openFL: 3.0.3
lime: 2.3.3
trivial code
package ;
import openfl.display.Sprite;
import openfl.text.TextField;
class Main extends Sprite
{
var tf:TextField;
public function new()
{
super();
tf = new TextField();
tf.text = "Hello";
tf.textColor = 0xFF0000;
addChild(tf);
}
}
Thanks Joshua on quick replay!
openfl test ios -Dlegacy gives me:
Warning: Could not find template file: iphone/PROJ/haxe/Build.hxml
Warning: Could not find template file: iphone/PROJ/haxe
Warning: Could not find template file: haxe
Warning: Could not find template file: iphone/PROJ/Classes
Warning: Could not find template file: iphone/PROJ/Images.xcassets
Warning: Could not find template file: iphone/PROJ/PROJ-Entitlements.plist
Warning: Could not find template file: iphone/PROJ/PROJ-Info.plist
Warning: Could not find template file: iphone/PROJ/PROJ-Prefix.pch
Warning: Could not find template file: iphone/PROJ.xcodeproj
Build settings from command line:
PLATFORM_NAME = iphoneos
SDKROOT = iphoneos8.3
xcodebuild: error: The directory /Users/igdeman/bin/ios does not contain an Xcode project.
I guess it could not find test project files or i’m doing something wrong? Good news is i’m seeing my “Hello” text now, i’ve changed code to use custom font and used -Dlegacy.
package ;
import openfl.Assets;
import openfl.text.Font;
import openfl.text.TextFormat;
import openfl.display.Sprite;
import openfl.text.TextField;
class Main extends Sprite
{
var t:TextField;
var tf:TextFormat;
var f:Font;
public function new()
{
super();
f = Assets.getFont("assets/fonts/vag.TTF");
tf = new TextFormat(f.fontName, 46, 0xffffff);
t = new TextField();
t.defaultTextFormat = tf;
t.text = "Hello";
addChild(t);
}
}