I am trying to create a TextField, populate it with some text and get this text dimensions, but when i am trying so:
var baka:TextField = new TextField();
baka.autoSize = true;
baka.htmlText = 'Hello World!';
trace(baka.textWidth); // undefined
trace(baka._width); // undefined
all i am getting by .textWidth and ._width is undefined. Why it may be so and how to fix that?
AS2 requires the use of the
createTextFieldmethod call. AS3 provides the ability to instantiate a TextField object and add it to the stage as you were trying to do.Here is an AS2 example that should work for what you are trying to do with AS2.
Please note the following:
_rootto match the object you are attempting to add theTextFieldto.createTextFieldmethod call won’t mean anything if you set theautoSizeproperty of the TextField to true