gpt4 book ai didi

ios - Flash Air iOS 开发 : Is it possible to launch a browser from within your applications?

转载 作者:塔克拉玛干 更新时间:2023-11-01 21:23:58 24 4
gpt4 key购买 nike

我使用 Flash Air 开发 iOS 游戏。能够从您的应用程序中启动浏览器会很好。任何想法将不胜感激!!

最佳答案

您可以使用 StageWebView在您的 AIR 应用程序中打开网页。

这是在屏幕右半边(又名舞台)打开页面的示例用法:

private var _web_view:StageWebView;
private function init_stagewebview(url:String):void
{
if (_web_view) {
throw new Error('init_stagewebview() called with existing _web_view - you must call cleanup first');
}
_web_view = new StageWebView();
var stage:Stage = NativeApplication.nativeApplication.activeWindow.stage;
_web_view.stage = stage;
_web_view.viewPort = new Rectangle(stage.stageWidth/2,0,stage.stageWidth/2, stage.stageHeight);
_web_view.addEventListener(ErrorEvent.ERROR, handle_error);
_web_view.addEventListener(IOErrorEvent.IO_ERROR, handle_error);
_web_view.addEventListener(SecurityErrorEvent.SECURITY_ERROR, handle_error);
_web_view.addEventListener(LocationChangeEvent.LOCATION_CHANGING, handle_loc_change);
_web_view.loadURL(url);
}

private function handle_loc_change(e:LocationChangeEvent=null):void
{
if (e) {
var loc:String = e.location;
trace(" -- webView location changed to: "+loc);

// Disable the navigation if you want to (this is a common
// way of passing data from web to AIR):
// e.preventDefault();
}
}

private function cleanup_web_view():void
{
if (_web_view == null) return;
_web_view.removeEventListener(ErrorEvent.ERROR, handle_error);
_web_view.removeEventListener(IOErrorEvent.IO_ERROR, handle_error);
_web_view.removeEventListener(SecurityErrorEvent.SECURITY_ERROR, handle_error);
_web_view.removeEventListener(LocationChangeEvent.LOCATION_CHANGING, handle_loc_change);
_web_view.viewPort = null;
_web_view.dispose();
_web_view = null;
}

private function handle_error(e:ErrorEvent):void
{
if (e) trace("- - - - webView Error:" + e.toString());
}

关于ios - Flash Air iOS 开发 : Is it possible to launch a browser from within your applications?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9272789/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com