Hello,

I am trying to assign a new StyleSheet object to the stylesheet
property of a TextArea control. When I create that TextArea
declarative using mxml I get an exception saying:

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]

The code:

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml";
layout="absolute">
<mx:Script>
        <![CDATA[
                import ....

             public function inits():void {
                        
                        var style:StyleSheet = new StyleSheet();

            /* var heading:Object = new Object();
            heading.fontWeight = "bold";
            heading.color = "#FF0000";

            var body:Object = new Object();
            body.fontStyle = "italic";

            style.setStyle(".heading", heading);
            style.setStyle("body", body); */
                        thetextarea.htmlText = "<body><span 
class='heading'>Hello
</span>World...</body>";
                        thetextarea.styleSheet = style; 
                }
        ]]>
</mx:Script>
        <mx:Button x="171" y="323" label="Button" click="inits()"/>
        <mx:TextArea id="thetextarea" x="40" y="245" width="800"  />
</mx:Application>

If you instanciate the TextArea programatically then you get a "null
pointer" type of exception.

Any ideas?

M.

PS: I noticed a post with a similar problem (but not a resolution) here:
http://groups.yahoo.com/group/flexcoders/message/34106








------------------------ Yahoo! Groups Sponsor --------------------~--> 
Yahoo! Groups gets a make over. See the new email design.
http://us.click.yahoo.com/XISQkA/lOaOAA/yQLSAA/nhFolB/TM
--------------------------------------------------------------------~-> 

--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/flexcoders/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 



Reply via email to