AIR实例教程HTMLLoader
点击下载查看程序
代码:
代码:
<?xml version="1.0" encoding="utf-8"?>
<mx:WindowedApplication xmlns:mx="http://www.adobe.com/2006/mxml"
creationComplete="init();"
layout="absolute" width="1024" height="768">
<mx:Script>
<![CDATA[
// imports
import flash.html.HTMLLoader;
import flash.net.URLRequest;
import mx.core.UIComponent;
// called on creationComplete
public function init():void
{
var htmlLoader:HTMLLoader = new HTMLLoader();
var urlReq:URLRequest = new URLRequest("http://www.novologic.com");
// HTMLLoader Class size defaults to 0,0 so you must size it.
htmlLoader.width = 1024;
htmlLoader.height = 768;
// load URLRequest
htmlLoader.load(urlReq);
// Create UIComponent to add html object to
var myComponent:UIComponent = new UIComponent();
myComponent.addChild(htmlLoader);
// now add component to stage
this.addChild(myComponent);
}
]]>
</mx:Script>
</mx:WindowedApplication>
<mx:WindowedApplication xmlns:mx="http://www.adobe.com/2006/mxml"
creationComplete="init();"
layout="absolute" width="1024" height="768">
<mx:Script>
<![CDATA[
// imports
import flash.html.HTMLLoader;
import flash.net.URLRequest;
import mx.core.UIComponent;
// called on creationComplete
public function init():void
{
var htmlLoader:HTMLLoader = new HTMLLoader();
var urlReq:URLRequest = new URLRequest("http://www.novologic.com");
// HTMLLoader Class size defaults to 0,0 so you must size it.
htmlLoader.width = 1024;
htmlLoader.height = 768;
// load URLRequest
htmlLoader.load(urlReq);
// Create UIComponent to add html object to
var myComponent:UIComponent = new UIComponent();
myComponent.addChild(htmlLoader);
// now add component to stage
this.addChild(myComponent);
}
]]>
</mx:Script>
</mx:WindowedApplication>