设为首页 加入收藏

TOP

Flash Web Game移植到Android平台需要注意的地方
2014-11-24 08:29:43 来源: 作者: 【 】 浏览:1
Tags:Flash Web Game 移植 Android 平台 需要 注意 地方

1、air不支持Security.allowDomain("*");


如同一个swf即要支持flash player播放,又要支持air,则通过类型来判断:


if(flash.system.Capabilities.playerType !="Desktop")
Security.allowDomain("*");


2、var cm:ContextMenu =new ContextMenu();


air的 cm.customItems为空。


3、报错:调用loader.loadBytes()方法时,SecurityError:Error #3226: Cannot import a SWF file when LoaderContext.allowCodeImport isfalse.


原因是没有设置LoaderContext.allowCodeImport,这样解决:


var con:LoaderContext = newLoaderContext();
con.allowCodeImport = true;
loadBytes(mc, con);


4、报错:1119: 访问可能未定义的属性allowCodeImport (通过 static 类型 flash.system:LoaderContext 引用)。


原因是使用了allowCodeImport属性,需要flash player 10.1才支持


5、报错:调用loader.load()方法时,SecurityError:Error #2142: Security sandbox violation: local SWF files cannot use theLoaderContext.securityDomain property.


原因是设置了LoaderContext,air不需要用new LoaderContext();


con = newLoaderContext(false,null,SecurityDomain.currentDomain);
loader.load(new URLRequest(_source), con);


6、旋转实现


stage.addEventListener(StageOrientationEvent.ORIENTATION_CHANGE,onOrientationChange);
private functiononOrientationChange(event:StageOrientationEvent):void
{
switch(event.afterOrientation)
{
caseStageOrientation.DEFAULT: // re-orient display objects based on // the default(right-side up) orientation.
stage.setOrientation(StageOrientation.DEFAULT)
break;
caseStageOrientation.ROTATED_RIGHT: // Re-orient display objects based on //right-hand orientation.
stage.setOrientation(StageOrientation.ROTATED_RIGHT)
break;
caseStageOrientation.ROTATED_LEFT: // Re-orient display objects based on //left-hand orientation.
stage.setOrientation(StageOrientation.ROTATED_LEFT)
break;
caseStageOrientation.UPSIDE_DOWN: // Re-orient display objects based on // upside-downorientation.
stage.setOrientation(StageOrientation.UPSIDE_DOWN)
break;
}
}


7、到目前为止,好像还不能实现手机麦克风(Microphone.isSupported为true,但不知为何说话没反应,待解决)


8、自定义air应用图标:修改-app.xml文件,icon属性



ico/16.png




】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
分享到: 
上一篇iOS开发:数据存储之plist文件操作 下一篇Shell控制流结构编程之测试目录创..

评论

帐  号: 密码: (新用户注册)
验 证 码:
表  情:
内  容:

·Redis on AWS:Elast (2025-12-27 04:19:30)
·在 Spring Boot 项目 (2025-12-27 04:19:27)
·使用华为开发者空间 (2025-12-27 04:19:24)
·Getting Started wit (2025-12-27 03:49:24)
·Ubuntu 上最好用的中 (2025-12-27 03:49:20)