立即显示 Flex 应用程序?
我正在 Flex 中开发一个小项目,它是一个将图像上传到服务器的应用程序。由于它是一个非常轻量级的应用程序(发布版本约为 40 kb),我希望它能够在加载 html 页面时立即显示。但不知何故,在显示之前有长达 1-2 秒的延迟。我认为这实际上是应用程序的加载和显示之间的延迟,并且我相信它可以被删除。
但是,我找不到如何缩短/消除延迟的解决方案。首先,我尝试禁用预加载器,但这没有任何作用。实际上,预加载器关闭和应用程序显示之间存在延迟(大约 500 毫秒 - 1 秒)。我的下一个猜测是编写一个自定义预加载器类来至少显示应用程序的图像(即使它不可单击,但至少可以显示一些内容)。
任何建议将不胜感激。
I'm working on a little project in Flex that's an application to upload images to a server. Since it's a pretty lightweight application (~40 kb in release version), I would like it to display instantly when the html page is loaded. But somehow there's a delay of up to 1-2 seconds before it shows up. I think it is a delay actually between the load and the display of the application, and I believe it could be removed.
However, I couldn't find a solution on how to shorten/remove the delay. First, I tried to disable the preloader, but this did nothing. There's actually a delay between a preloader shuts and the application displays (it is around 500 ms - 1 sec). My next guess was to write a custom preloader class to display at least an image of the application (even though it wouldn't be clickable, but at least something).
Any advice would be greatly appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
使用AS2,你会变得更简单和轻量级
尝试在as2中使用当前版本的swfloader
在flex4中使用它例如
合并到代码中,如下所示
http://devgirl.files.wordpress.com/2010/04/screen-shot-2010-04-07-at-2-26-32-pm.png
use AS2 instead, you'll get simpler and lightweight
try to use swfloader of current version in as2
use this in flex4 e.g.
Merged into code as here
http://devgirl.files.wordpress.com/2010/04/screen-shot-2010-04-07-at-2-26-32-pm.png
好吧,我实际上设法获得了所需的行为。不过你的评论很有用。
方法如下。我为我的应用程序实现了一个自定义预加载器,并在预加载器的构造函数中加载了处于禁用状态的应用程序的图像(读取:屏幕截图)(以便用户不想与其交互)。我使用了此链接中的快照演示 - http://blogs.adobe.com /aharui/2010/01/custom_preloader_downloadprogr.html
这是我为预加载器编写的代码(大部分来自下面的链接,剪辑版本)
:
{
}
我最终得到了一个很大的类,但它做了它应该做的事情。对代码的任何评论将不胜感激。
Well i actually managed to get the desired behavior. Your comments were useful though.
Here's how. I implemented a custom preloader for my application, and in the constructor of the preloader I loaded an image (read: screenshot) of my application in a disabled state (so that user won't want to interact with it). I used the SnapShot Demo from this link - http://blogs.adobe.com/aharui/2010/01/custom_preloader_downloadprogr.html
Here's the code that I wrote for the preloader (most of is is from the link below, a cut version):
package
{
}
I got a huge class eventually, but it does what its supposed to. Any comments on the code would be appreciated.