Hi,
How can I style my html content of a TextArea? I tried it like this but it keeps throwing errors:
var h1:Object = new Object();
h1.fontFamily = “DistrictThin”;
h1.color = “#FFCC00”;
h1.fontSize = 30;
h1.leading = 15;
h1.display = “block”;
var css:StyleSheet = new StyleSheet();
css.setStyle(“h1”,h1);
var styledTxt:TextArea = new TextArea();
styledTxt.width = textBox.width;
styledTxt.height = textBox.height;
textBox.addChild(styledTxt);
styledTxt.styleSheet = css;
styledTxt.htmlText = ‘<h1>Lorem Ipsum</h1><p>dolor sit amet dolor sit amet dolor sit amet</p>’;
Error: Error #2009: This method cannot be used on a text field with a style sheet.
at flash.text::TextField/set defaultTextFormat()
at mx.core::UITextField/set htmlText()[C:\dev\GMC\sdk\frameworks\mx\core\UITextField.as:314]
at mx.controls::TextArea/mx.controls:TextArea::commitProperties()[C:\dev\GMC\sdk\frameworks\mx\controls\TextArea.as:1787]
at mx.core::UIComponent/validateProperties()[C:\dev\GMC\sdk\frameworks\mx\core\UIComponent.as:5218]
at mx.managers::LayoutManager/mx.managers:LayoutManager::validateProperties()[C:\dev\GMC\sdk\frameworks\mx\managers\LayoutManager.as:517]
at mx.managers::LayoutManager/mx.managers:LayoutManager::doPhasedInstantiation()[C:\dev\GMC\sdk\frameworks\mx\managers\LayoutManager.as:658]
at Function/http://adobe.com/AS3/2006/builtin::apply()
at mx.core::UIComponent/mx.core:UIComponent::callLaterDispatcher2()[C:\dev\GMC\sdk\frameworks\mx\core\UIComponent.as:7789]
at mx.core::UIComponent/mx.core:UIComponent::callLaterDispatcher()[C:\dev\GMC\sdk\frameworks\mx\core\UIComponent.as:7732]
at flash.utils::Timer/flash.utils:Timer::_timerDispatch()
at flash.utils::Timer/flash.utils:Timer::tick()
Thanks! :block: :cross-eye