0 Replies Latest reply on Apr 17, 2008 11:35 PM by ab1301

    Increasing text size in HTML component

    ab1301 Level 1
      I asked this on the Flex forum, but no one was able to help. I want to increase the size of text rendered in an html component (like the zoom feature in a regular browser).

      Here is my own made-up solution to this problem:

      public function htmlEnlarge(target:HTML):void {
      var searchstr:RegExp = new RegExp("<html>", "i,s")
      target.htmlText = target.htmlText.replace(searchstr, "<html><style>body {font-family:Georgia;font-size:125%}</style>");
      }

      I call the function whenever I change the html component's contents. Its really hacky, and it doesn't work perfectly, but I can't waste any more time trying to figure this out for myself. There has to be a better way to do this: #1, I shouldn't have to go into the style sheets in the actual html document to enlarge the text rendered in the AIR app. #2, even if I do, there has to be a better way of doing it than regexp.

      In the Flex 3 Help, there is a page titled "Manipulating an HTML stylesheet from ActionScript," but that only addresses changing already existing CSS rules using their index numbers. This assumes that the document you are viewing has CSS rules to begin with, and that you already know the index number for the rules you want to change. There is a cryptic statement at the end of the help, which says "Keep in mind that code can add styles to the page after the HTMLLoader object dispatches the complete event." It would be nice to see some examples or explanation of how to do this.

      Does anyone here know the correct way to increase rendered text size in an html component?