Stylesheet problem in TextArea


hi,

 

i want edit content textarea after adding stylesheet. in below sample code has 2 textarea.

i added stylesheet in textarea1 can't able edit content.

in textarea2 has html content when alert gets unwanted textformat tags(i don't want tags how can restrict).

 

stylededitor.mxml

 

<?xml version="1.0" encoding="utf-8"?>

<s:windowedapplication xmlns:fx="http://ns.adobe.com/mxml/2009"

                       xmlns:s="library://ns.adobe.com/flex/spark"

                       xmlns:mx="library://ns.adobe.com/flex/mx" creationcomplete="init()">

   

    <fx:script>

        <![cdata[

            import mx.controls.alert;

            private var stylesheet:stylesheet;

            private var txt:string = "";

           

            private function init():void {

                var css:string = "h1 {font-size: 30;color:#ff0000;}p{font-size: 14;color:#00ff00;}a {text-decoration: underline;}a:hover {color: #ff0000;}div{font-size: 25;color:#0000ff;border:2px solid;} ";

                stylesheet = new stylesheet();               

                stylesheet.parsecss(css);

                textarea1.stylesheet = stylesheet;

                txt = "<h1>welcome</h1><p>this <font color='#333333' font-weight='bold'>is</font> para</p><div>this div</div>";

                textarea1.htmltext = txt;

                textarea2.htmltext = txt;

            }

                       

            private function check():void{

                alert.show("test");

                alert.show("text area1:"+textarea1.htmltext);

                alert.show("text area2:"+textarea2.htmltext);

            }

        ]]>

    </fx:script>

   

    <mx:vdividedbox horizontalscrollpolicy="on" height="2000">

        <mx:button id="click" label="click" click="check()">

           

        </mx:button>

        <mx:textarea id="textarea1" editable="true"

                     condensewhite="true" width="400"

                     height="210">

        </mx:textarea>

       

        <mx:textarea id="textarea2" editable="true"

                     condensewhite="true" width="400"

                     height="210" >

        </mx:textarea>

    </mx:vdividedbox>

   

</s:windowedapplication>

 

text area1:<h1>welcome</h1><p>this <font color='#333333' font-weight='bold'>is</font> para</p><div>this div</div>

 

text area2:<textformat leading="2"><p align="left"><font face="arial" size="12" color="#000000" letterspacing="0" kerning="0">welcomethis <font color="#333333">is</font> para<font color="#333333"></font></font></p></textformat><textformat leading="2"><p align="left"><font face="arial" size="12" color="#000000" letterspacing="0" kerning="0">this div</font></p></textformat>

 




More discussions in Flex (Read Only)


adobe

Comments

Popular posts from this blog

Is this Captcha code corrupt?

How to Grab email address from webform and insert into form action

Thread: "Broken" background image with Super Key