码迷,mamicode.com
首页 > Web开发 > 详细

air 加载网页

时间:2021-06-11 19:15:57      阅读:0      评论:0      收藏:0      [点我收藏+]

标签:mod   this   listener   nat   browser   port   location   false   sys   

package  {
	
	import flash.display.MovieClip;
	import flash.html.HTMLLoader;   
	import flash.net.URLRequest;   
	import fl.core.UIComponent; 
	import flash.display.StageScaleMode;
	import flash.display.StageAlign;
	import flash.display.StageQuality;
	import flash.display.NativeWindowInitOptions;
	import flash.events.LocationChangeEvent;
	import flash.events.MouseEvent;
	import flash.geom.Rectangle;
	public class htmlload extends MovieClip {
		
		var htmlLoader:HTMLLoader = new HTMLLoader(); 
		public function htmlload() {
			//Stage.scaleMode = "noScale";
			stage.scaleMode = StageScaleMode.NO_SCALE
			stage.align = StageAlign.TOP_LEFT; 
			stage.quality = StageQuality.BEST;
			init();
		}
		public function init():void   
		{   
			var urlReq:URLRequest = new URLRequest("http://www.baidu.com");   
 
			htmlLoader.width = 1280;   
			htmlLoader.height = 960;   
			//htmlLoader.paintsDefaultBackground = false;
			htmlLoader.load(urlReq);
			htmlLoader.addEventListener( LocationChangeEvent.LOCATION_CHANGING, onLocationChanging );
			htmlLoader.addEventListener( LocationChangeEvent.LOCATION_CHANGE, onLocationChang);
 			//htmlLoader.navigateInSystemBrowser = true;
			var myComponent:UIComponent  = new UIComponent();   
			myComponent.addChild(htmlLoader);   
			this.addChild(myComponent);   
		}

		private function onLocationChanging( event:LocationChangeEvent ):void
        {
            trace( "Location changing: " + event.location );
        }
		private function onLocationChang( event:LocationChangeEvent ):void
        {
            trace( "Location chang: " + event.location );
        }

	}
	
}

  

air 加载网页

标签:mod   this   listener   nat   browser   port   location   false   sys   

原文地址:https://www.cnblogs.com/dt1991/p/14875465.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!