Adobe AIR - 带图像的自定义预加载器
各位,
我设计了一个 Adobe AIR
应用程序。我想在它打开之前显示一些预加载器
。
谁能指导我有关预加载器
专门针对 AIR 或任何已内置预加载器的教程?
谢谢
Folks,
I have designed an Adobe AIR
application. I want to show some preloader
on it, before it opens up.
Can anyone guide me with tutorials on preloader
aimed for AIR specifically or any already built in ones?
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
借助 AIR,我可以想出几种方法来实现这一目标:
1。对于本机窗口
将主 WindowedApplication 的“visible”属性设置为“false”。在“creationComplete”事件中,会生成一个包含启动屏幕的新窗口。在显示应用程序之前执行必要的逻辑。引导完成后,关闭启动屏幕并将主应用程序的“可见”设置为“true”。
2.在一个窗口中,使用 states
创建 2 个状态(例如“正在加载”和“正常”)。将主 WindowedApplication 的“currentState”属性设置为“loading”。在此状态下显示您的启动屏幕。在显示应用程序之前执行必要的逻辑。引导完成后,将“currentState”属性设置为“正常”。在“正常”状态下显示您的实际应用程序。
3.透明应用程序
使用透明 AIR 应用程序,您可以使用状态(如 n° 2)和假窗口。然后,您的主应用程序将是一个覆盖整个屏幕的透明窗口。现在,您可以将启动屏幕和主视图放置在透明窗口内的任意位置。不用担心:您可以点击透明窗口,这样就不会遮挡任何内容。
我可以向您展示一些代码,但我需要有关您的应用程序的更多具体信息。
编辑:示例
最简单的解决方案是第 2 种:
Windows 示例
这需要更多解释:在您的应用程序中,您必须将 'systemchrome' 设置为 'none' ,“可见”到“假”,“透明”到“真”。您还必须将“visible”属性设置为“false”。这些设置将有效隐藏主应用程序窗口。然后,我们依次创建一个用于启动屏幕的窗口和一个用于主视图的窗口。重要的是,主 WindowedApplication 保持不可见,因为另一种方法会在启动屏幕显示之前使该窗口短暂可见(似乎是一个错误)。
With AIR I can think of a couple of ways to achieve that:
1. with native windows
Set the 'visible' attribute of your main WindowedApplication to 'false'. On 'creationComplete' event spawn a new Window that contains your splash screen. Perform the necessary logic before showing the app. When the bootstrap is done close the splash screen and set the main appliation's 'visible' to 'true'.
2. in one window, using states
Create 2 states (e.g. 'loading' and 'normal'). Set the 'currentState' attribute of your main WindowedApplication to 'loading'. In this state display your splash screen. Perform the necessary logic before showing the app. When the bootstrap is done, set the 'currentState' attribute to 'normal'. In the 'normal' state display your actual application.
3. transparent application
With a transparent AIR application, you could work with states (as in n° 2) and fake windows. Your main application will then be a transparent window that covers the entire screen. You can now position the splash screen and the main view wherever you wish inside this transparent window. Don't worry: you can click through transparent windows so nothing will be blocked.
I could show you some code, but I'd need more specific information about your application.
Edit: example
The easiest solution would be nr 2:
example with windows
This one requires more explanation: in your application you'll have to set 'systemchrome' to 'none', 'visible' to 'false' and 'transparent' tot 'true'. You also have to set the 'visible' attribute to 'false'. These settings will effectively hide the main application window. We then sequentially create a window for the splash screen and one for the main view. It is important that the main WindowedApplication stays invisible, because another approach would make that window briefly visible before the splash screen shows up (seems to be a bug).
您的意思是启动画面
非官方:
官方:
但是,我不相信有挂钩可以让您显示应用程序加载状态的实时进度。
您可以尝试通过嵌入一个 swf 来模拟这一点,该 swf 具有(模拟的)进度条,显示您的虚假进度。
What you mean is a splash screen
Unofficial:
Official:
However, I do not believe there are hooks that will enable you to show a real time progress of your application load status.
You could try simulating this by embedding an swf that has a (simulated) progressbar showing you fake progress though.
如果这是一个移动应用程序,并且您只需要一个启动屏幕:
在主应用程序的 mxml 文件内,将:插入
到 ViewNavigatorApplication 块中。
检查规格:
http://opensource.adobe.com/wiki/display /flexsdk/Mobile+Splash+Screen
If this is a mobile app and you just want a splash screen:
Inside the main application's mxml file, insert:
into the ViewNavigatorApplication block.
Check the specs:
http://opensource.adobe.com/wiki/display/flexsdk/Mobile+Splash+Screen