Skip to content

Instantly share code, notes, and snippets.

@Draknek
Created August 1, 2012 12:33
Show Gist options
  • Save Draknek/3226441 to your computer and use it in GitHub Desktop.
Save Draknek/3226441 to your computer and use it in GitHub Desktop.
TextField.htmlText links in Haxe aren't clickable
// AS3 version, works
package
{
import flash.display.Sprite;
import flash.text.TextField;
import flash.text.TextFieldAutoSize;
import flash.text.StyleSheet;
public class LinkTest extends Sprite
{
public function LinkTest()
{
super();
var textField:TextField = new TextField();
textField.htmlText = '<a href="http://google.com/" target="_blank">This should be a clickable link</a>';
textField.mouseEnabled = true;
textField.autoSize = TextFieldAutoSize.LEFT;
textField.textColor = 0x0;
textField.x = 20;
textField.y = 20;
addChild(textField);
}
}
}
// Same code in Haxe, doesn't work
class LinkTest extends flash.display.Sprite
{
public function new()
{
super();
var textField = new flash.text.TextField();
textField.htmlText = '<a href="http://google.com/" target="_blank">This should be a clickable link</a>';
textField.mouseEnabled = true;
textField.autoSize = flash.text.TextFieldAutoSize.LEFT;
textField.textColor = 0x0;
textField.x = 20;
textField.y = 20;
addChild(textField);
}
public static function main()
{
flash.Lib.current.addChild(new LinkTest());
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment