Created
August 1, 2012 12:33
-
-
Save Draknek/3226441 to your computer and use it in GitHub Desktop.
TextField.htmlText links in Haxe aren't clickable
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // 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); | |
| } | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // 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