Get actual width of a textfield's text content


This is more of a HaxeFlixel question, but since HF uses OpenFL, someone might know something about this. I want to get the actual width of the text content of a FlxText object so the easiest way to go about this I thought was to:

// Enable autosize
wordWrap = false; autoSize = true;
// Take note of new width
textWidth = fieldWidth;
// Disable autosize
autoSize = false; wordWrap = true; 
// Use the width as the new field width
fieldWidth = textWidth;

I notice that textWidth has some weird numerical value that doesn’t make much sense. For short text of a few characters, the value is a single digit like 4, or 5. If it gets long enough like a 10 character word, it jumps to something like 200. While the above code has worked in a Flash target, Android seems to be ignoring or not know the width of the autosized text. Does anyone know how to get the actual width of a textfield (FlxText)'s text content?