0 Replies Latest reply on Feb 10, 2009 1:40 AM by pgianf

    AIR / HTML Bridging


      I'm trying to handle an HTML page loaded using the mx.controls.HTML, when trying to access the div element inside the page, using the domWindow object, I've realized that i dont have getElementById function so i insert the following javascript function

      function setText(id, text) {
      var target = document.getElementById(id);
      if (target != null) target.innerHTML = text;

      and I call it from AIR in this way
      browser.domWindow.setText("description", text);

      the text is assigneg form a RTE control after a cleaning operation of the produced tags and styles

      text = cleanHTML( rte.textArea.htmlText) ; the result of cleaning doesnt introduce any strange char just put
      the html font tags in a compliant form.

      it works but I have problem with chars like à è ì ò ù space, thart are shows in the html page as %E0, %E8, %20, ......
      I've tried to understand why, the html page has this meta:
      <meta http-equiv="Content-Type" content="text/html" charset="ISO-8859-1" />
      the page code of the HTML editor is using the same charset.

      If I put an alert(text) in the javascritp function i can see that the problem is already present and when tracing text variable in the AIR app just before calling the javascript the result is a clean string, so it's something in the middle.
      Is there other ways to set a text in an HTML page from Air, is there a list of available javascript functions.

      A part of this problem the bridge between the twos works well, AIR lets you to have a lot of control over the browser.
      It it would be possible to have a better Flex Rich Text Editor control would be really nice

      Thanks in advance