puk*_*978 3 actionscript-3 starling-framework
我已经在AS3和Starling中开发了一个应用程序,可以移植到IOS.我已经更新了Default.png图像,这很有效但是我的应用程序需要一段时间才能加载,黑屏会显示大约3-4秒.
我到处寻找解决方案,但找不到任何工作.有人有工作解决方案吗?
非常感谢
我不确定目前是否有更简洁的解决方案,但我所做的是将默认屏幕的位图添加到本机Flash阶段.然后,当Starling准备就绪时,我删除了位图.
因此,在实例化Starling之前,将位图图像添加到舞台(这将是Flash舞台)
public static var _splash:Bitmap;
//load or embed your bitmap//
addChild(_splash);
Run Code Online (Sandbox Code Playgroud)
然后实例化并启动Starling.例如
myStarling = new Starling(Main, stage, null, null, Context3DRenderMode.AUTO, Context3DProfile.BASELINE);
myStarling.stage3D.addEventListener(starling.events.Event.CONTEXT3D_CREATE, function(e:flash.events.Event):void {
// Starling is ready!
myStarling.start();
});
Run Code Online (Sandbox Code Playgroud)
在您的根Starling类中(在此示例中为Main),使用ADDED_TO_STAGE侦听器,当触发此操作时,删除位图.
public function Main() {
addEventListener(starling.events.Event.ADDED_TO_STAGE, onAdded);
}
private function onAdded ( e:starling.events.Event ):void {
StartUp._splash.parent.removeChild(StartUp._splash);
StartUp._splash = null;
}
Run Code Online (Sandbox Code Playgroud)
在上面的示例中,根文档类称为"StartUp".