Skip to main content
May 13, 2009
Question

Render HTML in FLEX

  • May 13, 2009
  • 2 replies
  • 1206 views

Hi All,

I am facing one problem, i want to display some html contents in my
flex application. I tried that using iframe but its not working (If u
click out side that iframe, then it will hide iframe).

I want to do this with out using (AIR). I searched this on internet
but i didn't get any solution for that.

So if anybody knows how to solve this plz send help me.

Thanx in advance ......

Regards,
Pradip jadhav

This topic has been closed for replies.

2 replies

Inspiring
July 28, 2010

Well, simply put, you cant' have full HTML inside a Flash App without Air.

But there are nice tricks around this, and you don't have to use IFrames.

In the html file that hosts your Flash/Flex app you have to create a DIV that will be in absolute position and will be Above (in Z order) the Flash app.  Then it's just a matter of alingning things, you might have to do some trial and error with different browsers.

And YES you can control the output of the div from you Flex/Flash app.

you will probably need a little javascript on the html side to receive the data from the flex app and from the flex app you need to call ExternalInterface.

Example:

Flex app:

     if (ExternalInterface.available)
       {
          ExternalInterface.call("UpdateMyDiv","MyDiv","Hello World");                                    
       }

From the javascript side (in the html):

     <script type="text/javascript">

     function UpdateMyDiv(divName,message)
      {
         if (document.getElementById)
           { // DOM3 = IE5, NS6
            document.getElementById(divName).innerHTML = message;
           }
      }

Be aware that that Javascript won't work on older browsers, but that's a browser thing.

I believe you can see this concept implemented in www.runpee.com  where he has google adds as html inside a Flex 4 app.  From browsing the source of the web page I deduced that's how he did it.

Participant
November 23, 2009

Me too!