TextField.textHeight is zero

45 views
Skip to first unread message

Magnus

unread,
Dec 27, 2012, 11:56:49 AM12/27/12
to haxe...@googlegroups.com
I created swf9 project with a simple flash.text.TextField which used to work fine.

Now, a couple of months later, I basically recompiled the same code and all my textfields have the text shifted to the top of the widget (if visible at all), and I found that the textHeight property is always returned as zero whatever the text is.

The textWidth property still works OK and differs with the entered text.

(I'm using haxe 2.07 and swfmill 0.3.2)

Any ideas on what I can check?

Jan_Flanders

unread,
Dec 27, 2012, 1:29:40 PM12/27/12
to haxe...@googlegroups.com

Swfmill does not generate classes for the assets you embed. In the past the haxe compiler automatically generated them for you (based on what it found inside the swfmill swf), but since haxe 2.06 it no longer does and you'll have to create them yourself. Add for example to you haxe code:
class MyFont extends flash.text.Font {}

You can also try this:
" 2)Tool that repairs (older)swfmill swfs (which may no longer work with the new swf linker in haXe 2.06)
It injects an abc-file per asset and a symbol class tag as well:
http://www.haxer.be/zips/SymbolClassABCInjector.zip "
From here : http://haxe.org/forum/thread/3395#nabble-td5438798

Jan

Rocks Wang

unread,
Dec 27, 2012, 1:57:35 PM12/27/12
to haxe...@googlegroups.com
I didn't encounter this, before I retrieve the textWidth/textHeight properties, I always draw the TextField to a dummy BitmapData to force it flush the value.

Rocks

在 2012年12月28日星期五UTC+8上午12时56分49秒,koma77写道:

koma77

unread,
Dec 27, 2012, 2:54:12 PM12/27/12
to haxe...@googlegroups.com
Interesting theory, but it may not be the case.

A friend of mine used the same version of haxe and swfmill and it works on his computer.

The only difference seems to be in the swf-file generated from (the same version of) swfmill related to fonts:

diff:
-      <DefineFont3 objectID="17" isShiftJIS="0" isUnicode="0" isANSII="0" wideGlyphOffsets="1" italic="0" bold="0" language="0" name="VeraFont" ascent="0" descent="0" leading="0">
+      <DefineFont3 objectID="17" isShiftJIS="0" isUnicode="0" isANSII="0" wideGlyphOffsets="1" italic="0" bold="0" language="0" name="VeraFont" ascent="19010" descent="4830" leading="4100">


As you can see the ascent, descent and leading is zero in my case.

Maybe a lib used by swfmill differs? Maybe libfreetype or something like that?

I'm running an updated Ubuntu 12.10.

koma77

unread,
Dec 27, 2012, 6:20:37 PM12/27/12
to haxe...@googlegroups.com
As this seems to be a bug in swfmill I've opened an issue there instead:

Reply all
Reply to author
Forward
0 new messages