Copy link to clipboard
Copied
hello,
I'm trying to make a combobox so the user can change the fontstyle they input in a dynamic text field.
Right now it says that the properties of fontStyle and setStyle are undefined properties o f TextRenderer and Textfield.
This is what I have so far.
//change font style
fontStyleCombo.prompt = "Font Style";
fontStyleCombo.addItem({label:"Medium"});
fontStyleCombo.addItem({label:"Bold"});
fontStyleCombo.addItem({label:"Italic"});
fontStyleCombo.addItem({label:"Bold Italic"});
fontStyleCombo.addEventListener(Event.CHANGE, setFontStyle);
function setFontStyle(evt:Event):void
{
var fontStyles:Object = "Bold";
if(fontStyleCombo.selectedIndex > -1)
{
fontStyles = fontStyleCombo.selectedItem.data;
}
var fontStyleFormat:TextRenderer = new TextRenderer();
fontStyleFormat.fontStyle = fontStyles;
inputTextRender01.setStyle(fontStyleFormat);
}
What class of object is the Textfield? If it is a dynamic TextField then it doesn't have properties nor methods such as you are trying to implement. For TextField instance you should be using the setTextFormat method along with having defined the different formats to set.
Copy link to clipboard
Copied
What class of object is the Textfield? If it is a dynamic TextField then it doesn't have properties nor methods such as you are trying to implement. For TextField instance you should be using the setTextFormat method along with having defined the different formats to set.
Copy link to clipboard
Copied
Thanks. I ended up putting the styles in the font face combo box.
Copy link to clipboard
Copied
You're welcome
Find more inspiration, events, and resources on the new Adobe Community
Explore Now