I have a TLFTextField created in Flash Professional and I'm attempting to alter it's appearance via code, in Flash Builder.
I want to retain all formatting rules already applied to the TLFTextField unless I specifically change them, however the following code:
var format:TextFormat = textField.getTextFormat(); format.align = TextFormatAlign.RIGHT; textField.defaultTextFormat = format;
Is producing an error at run-time:
RangeError: Property lineHeight value -2147483648 is out of range at flashx.textLayout.property::Property$/defaultErrorHandler() at flashx.textLayout.property::NumberOrPercentProperty/setHelper() at flashx.textLayout.formats::TextLayoutFormat/set lineHeight() at fl.text::TLFTextField/createTextLayoutFormat()[/Volumes/BuildDrive/Stage/Flash11_Main_485_Stage/main/authortool/Stage/tlfRuntime/fl/text/TLFTextField.as:2244] at fl.text::TLFTextField/set defaultTextFormat()[/Volumes/BuildDrive/Stage/Flash11_Main_485_Stage/main/authortool/Stage/tlfRuntime/fl/text/TLFTextField.as:2194]
Does anyone have any ideas as to how to alter individual formatting properties on a TLFTextField without affecting those already set?
it looks like you'll need to create a function that will assign correct default values for unassigned properties when using tfltextfields IF you want to retrieve the original textformat. however, if you just want to change some of the textformat properties, create a new textformat instance, assign the properties and assign the defaulttextformat of your textfield.