Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

set fontStyle in dynamic text with a combobox

Community Beginner ,
Jan 13, 2013 Jan 13, 2013

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);

   

}

TOPICS
ActionScript
560
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

LEGEND , Jan 13, 2013 Jan 13, 2013

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.

Translate
LEGEND ,
Jan 13, 2013 Jan 13, 2013

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jan 17, 2013 Jan 17, 2013

Thanks. I ended up putting the styles in the font face combo box.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jan 17, 2013 Jan 17, 2013
LATEST

You're welcome

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines