Flash Air iOS 开发:是否可以从应用程序内启动浏览器?

发布于 2025-01-05 22:28:00 字数 63 浏览 0 评论 0原文

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

I use Flash Air to develop iOS games. It would be nice to be able to launch a browser from within your applications. Any ideas would be appreciated!!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

小情绪 2025-01-12 22:28:00

您可以使用 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());
}

You can use StageWebView to open a web page within your AIR app.

Here's a sample usage to open a page on the right half of the screen (aka stage):

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());
}
锦上情书 2025-01-12 22:28:00

调用 navigateToURL() (docs)将系统浏览器应用程序启动到您指定的 URL(将您的应用程序留在后台):

import flash.net.navigateToURL;
import flash.net.URLRequest;

navigateToURL(new URLRequest("http://google.com"), "_blank");

Calling navigateToURL() (docs) from an AIR app launches the system browser app to the URL you specify (leaving your app in the background):

import flash.net.navigateToURL;
import flash.net.URLRequest;

navigateToURL(new URLRequest("http://google.com"), "_blank");
树深时见影 2025-01-12 22:28:00

使用 AIR 特定类 HTMLControl 怎么样?
据我了解,您希望在屏幕应用程序的一部分中启用网络导航。

http://www.mikechambers.com/blog/2007/11/09/using-the-htmlcontrol-in-adobe-air-to-parse-html-as-a-data-source/

How about using the AIR specific class HTMLControl ?
As I understand you want to enable web navigation withing a portion of your screen app.

http://www.mikechambers.com/blog/2007/11/09/using-the-htmlcontrol-in-adobe-air-to-parse-html-as-a-data-source/

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文