3 Replies Latest reply on Sep 8, 2011 12:11 AM by Barno7

    TextArea And Html..only editable ?

    Barno7 Level 1

      hi,

      i want do a TextArea with HtmlText inside, i follow this Example inside the documentation:

       

      http://pastebin.com/GRyUc67G

       

      this is works, but if i do a textArea non editable, i can't scroll the content. i try use init instead creationComplete, the scroll works, but the textArea content is bottom

        • 1. Re: TextArea And Html..only editable ?
          Daniel Pride Level 1

          If I understand you question properly.... and assuming you are indeed talking about the mobile Flex not web...

          There is a property called verticalScrollPolicy that you need to enable

          i.e. verticalScrollPolicy='on'

           

          However I think you would be better off using StageWebView

          Something like

           

          protected var myHtml:StageWebView = new StageWebView;

           

          protected function init():void{

          myHtml.stage = stage;

          myHtml.viewPort = new Rectangle(0,0,100,100);

          myHtml.load(thestuffyouwanttodisplay);

           

          }

           

          Someone else may be able to do it but I think editable html at this point is beyond the pale... things like Rich Text are not supported in the Mobile components that are currently available.

          Dan Pride

          • 2. Re: TextArea And Html..only editable ?
            Barno7 Level 1

            thanks for the answer,

            but I can not to load HTML text into this object

            • 3. Re: TextArea And Html..only editable ?
              Barno7 Level 1

              i use this code

               

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

              <!-- mobile_text/HTMLTextView.mxml -->

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

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

              addedToStage="addedToStageHandler()">

               

              <fx:Script>

               

              <![CDATA[

              protected var webView:StageWebView = new StageWebView();

               

              protected var counter:int = 0;

               

              protected var url:String = "http://coenraets.org/webview/index.html";

               

              protected function addedToStageHandler():void

              {

              var styles:String = "p { color: #33CCFF; font-size:30;}";

              var myStyleSheet:StyleSheet = new StyleSheet();

              myStyleSheet.parseCSS(styles);

              var pippo:String =  "<!DOCTYPE HTML>" +

              "<html>" +

              "<body>" +

              "<h1 style='background: blue; color: white;'>Title</h1>" +

              "<p>Hello World.</p>" +

              "</body>" +

              "</html>";

               

              webView.stage = stage;

              webView.viewPort = new Rectangle(0,100,600,30);

               

              //webView.loadURL(url);

              webView.loadString(pippo,"text/html");

               

              }

              ]]>

              </fx:Script>

              </s:View>

               

              with this code, i see the text with background and color, but:

               

              - the scrollbar is not that of texr field?

              - how can i associate the file css?

               

              thanks!