I'm building an as3 only web application and want to be able to include external html co开发者_如何学JAVAntent within a flash 'window'. In AIR there is the flash.html.HTMLLoader class which makes this possible.
Can anyone point to an example of this being done in a flash as opposed to AIR application?
Hi I know its an old post but here goes anyways. Requires AIR as publish setting.
import flash.html.HTMLLoader;
//web broswer with window
private var html_browser:HTMLLoader;
//if not constructed
if (html_browser == null || html_browser.stage.nativeWindow.closed) {
//options
var pulse_initOptions:NativeWindowInitOptions = new NativeWindowInitOptions();
//bounds
var pulse_bounds:Rectangle = new Rectangle(20, 20, 984, 590);
//create window
html_browser = HTMLLoader.createRootWindow(true, pulse_initOptions, true, pulse_bounds);
}
//url
var pulse_urlReq:URLRequest = new URLRequest("http://www.google.com");
//load
html_browser.load(pulse_urlReq);
//bring to front
html_browser.stage.nativeWindow.activate();
//visible
html_browser.stage.nativeWindow.visible = true;
For loading the HTML content, i really recommend you BulkLoader.
To display the html, just use TextField with htmlText. But please, be aware that just some tags are supported.
I know the Dynamic Text object in the visual editor has a property to support HTML formatting. You will just use URLRequest and URLLoader classes to get your data, then stuff it in the textbox. I don't know if this is robust enough for you, but I can't find any other way to do this. Please let us know if you do.
精彩评论