/** 点击选项 **/ private function onMc_Click(mc:GAFMovieClip, obj:Object, i:int):void { //AIR内嵌网页 var vo:ShopVO = obj as ShopVO; // openWebView(vo.ShopUrl); } /** 内嵌网页 */ private function openWebView(url:String):void { // if (webView == null) { webView = new StageWebView(); webView.stage = Starling.current.nativeStage; webView.viewPort = new Rectangle(0, height, webView.stage.fullScreenWidth, webView.stage.fullScreenHeight); webView.addEventListener(LocationChangeEvent.LOCATION_CHANGE, onLocationChange); } // tip.visible = true; attachEvent(tip.back, onBack); webView.loadURL(url); } private function closeWebView():void { // tip.visible = false; detachEvent(tip.back, onBack); // if (webView != null) { webView.viewPort = null; webView.stage = null; webView.dispose(); webView = null; } } private function onLocationChange(e:Event):void { } private function onBack(e:TouchEvent):void { var touch:Touch = e.getTouch(this,TouchPhase.BEGAN); if(touch){ closeWebView(); } }
AS3.0游戏内嵌网页
最新推荐文章于 2021-06-10 14:45:00 发布