[flexcoders] Load HTML from URL into Flex Component (via iframe)

2008-02-26 Thread byte.sensei

I've got a Flex site with several pages that load HTML content from an
older HTML version of the site into an iframe that I then place over the
Flash movie so it looks like the content has been embedded into the Flex
UI even though it's still being loaded from the old HTML site.

I've got the following Javascript function to load the HTML content into
the iframe:

function loadIFrame(url){
  document.getElementById(myFrame).innerHTML = iframe id='myIFrame'
src=' + url + ' frameborder='0'/iframe;
  Alert.show(url);
}

I added the Alert.show for testing so I'd get a Javascript alert box
if/when this Javascript function fires.

Inside my Flex app, I'm using the following code to refresh the iframe
based on a URL:

ExternalInterface.call(loadIFrame, source);

I'm using the show event of a VBox component to make the
ExternalInterface.call to the Javascript function.  I've verified via
trace that the show event is firing and the ExternalInterface.call()
function is executing, but the iframe never loads the URL nor does the
Javascript Alert.show() function execute.

It seems to work some of the time, but not consistently and not in any
pattern I can distinguish.  Am I missing something here? Is there a
different/better approach for loading HTML content via an HTTP GET into
a Flex UI?  If not, how can I get this to work properly/consistently?

Cheers!







[flexcoders] Load HTML from URL into Flex Component

2007-11-28 Thread byte.sensei
I have a Flex 3 application that generates HTML, PDF, and Excel reports 
from SQL Server Reporting Services.

In the case of HTML, I've been using navigateToURL() to load the result 
into the browser.  This works fine, but I'd really like to embed the 
HTML into a Flex container and wrap the application 
navigation/header/footer around it so that the user stays in the Flex 
app and has access to all of the site navigation, etc.

In the Flex/AIR documentation there's lots of examples that use 
HTMLControl / URLRequest to load the HTML content of a URL and then add 
the HTMLControl display object.  However, the required 
flash.html.HTMLControl library is not available in Flex.

I tried using flash.display.Loader / URLRequest and then used 
this.rawChildren.addChild() but that doesn't seem to work either - the 
page is just blank.  I thought maybe I needed to specify the 
height/width but that didn't make any difference.  Here's the code I'm 
using:

import flash.display.Loader;
import flash.net.URLRequest;

private function load_html() : void {
  var html:Loader = new Loader();
  var urlReq:URLRequest = new URLRequest(http://www.symetri.com/;);
  html.width = 900;
  html.height = 900;
  html.load(urlReq); 
  html_box.rawChildren.addChild(html);
}

The function runs on creationComplete() of the html_box VBox container.

Isn't there some type of HTMLLoader Flex component similar to SWFLoader 
out there somewhere that will do this sort of thing? If not, any other 
suggestions?





Re: [flexcoders] Load HTML from URL into Flex Component

2007-11-28 Thread Derrick Anderson
maybe this link can be of some help to you

http://www.deitte.com/IFrameDemo3/IFrameDemo.html

d.

On Nov 28, 2007 10:48 AM, byte.sensei [EMAIL PROTECTED] wrote:

   I have a Flex 3 application that generates HTML, PDF, and Excel reports
 from SQL Server Reporting Services.

 In the case of HTML, I've been using navigateToURL() to load the result
 into the browser. This works fine, but I'd really like to embed the
 HTML into a Flex container and wrap the application
 navigation/header/footer around it so that the user stays in the Flex
 app and has access to all of the site navigation, etc.

 In the Flex/AIR documentation there's lots of examples that use
 HTMLControl / URLRequest to load the HTML content of a URL and then add
 the HTMLControl display object. However, the required
 flash.html.HTMLControl library is not available in Flex.

 I tried using flash.display.Loader / URLRequest and then used
 this.rawChildren.addChild() but that doesn't seem to work either - the
 page is just blank. I thought maybe I needed to specify the
 height/width but that didn't make any difference. Here's the code I'm
 using:

 import flash.display.Loader;
 import flash.net.URLRequest;

 private function load_html() : void {
 var html:Loader = new Loader();
 var urlReq:URLRequest = new URLRequest(http://www.symetri.com/;);
 html.width = 900;
 html.height = 900;
 html.load(urlReq);
 html_box.rawChildren.addChild(html);
 }

 The function runs on creationComplete() of the html_box VBox container.

 Isn't there some type of HTMLLoader Flex component similar to SWFLoader
 out there somewhere that will do this sort of thing? If not, any other
 suggestions?