在弹性应用程序中执行加载程序的最佳方式?

发布于 2024-10-31 00:42:55 字数 296 浏览 3 评论 0原文

在 Flex 应用程序中使用加载程序的最佳方法是什么?我有一个动画 .gif 用作我们的加载程序(每当我需要等待操作完成时),但我不确定最好的方法。

这就是我的想法:

让加载器成为自定义组件。 在父应用程序上,为我的自定义事件 AceEvent.SHOW_LOADER 添加事件侦听器。 在事件侦听器中,使用 PopUpManager 显示加载程序。 监听 AceEvent.HIDE_LOADER。 通过 PopUpManager 摆脱加载程序。

您对此有何看法?有更好的方法吗?

谢谢!

安德鲁

What is the best way to do a loader in a flex application? I have an animated .gif that is to be used as our loader (whenever I need to wait for an action to complete), and I am not sure the best way to do it.

This is how I am thinking:

Have the loader be a custom component.
On the parent application, add an event listener for my custom event AceEvent.SHOW_LOADER.
In the event listener, use the PopUpManager to show the loader.
Listen for AceEvent.HIDE_LOADER.
Get rid fo the loader via PopUpManager.

What do you think about this? Is there a better way to do it?

Thanks!

Andrew

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

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

发布评论

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

评论(2

独﹏钓一江月 2024-11-07 00:42:55

好吧,我上次检查过,GIF 动画在 Flex 中不起作用,除非您有解决方法。不过,我不会使用 gif 动画来创建动画,因为它们的质量较低。我只是使用 Flash 重新创建它。

然而,我做加载程序的方式会非常不同。就我个人而言,我不相信“系统加载器”,除非它是您应用程序的预加载器。这样做的原因是,可能同时加载多个内容(可能彼此不知道),这意味着加载器弹出窗口可能会在加载所有内容之前消失(第一个加载,分派事件并删除弹出窗口,而另一个仍在加载)。

我喜欢做的是为弹出加载器创建一个自定义组件(因为它将被大量重用),从那里我可以使用适合我的视图的状态,或者绑定一个布尔标志以在 true 时显示弹出窗口(这可以使用 Parsley 等框架轻松完成)。弹出窗口只会覆盖系统中实际加载数据的部分(因为我怀疑您的整个应用程序是否同时加载数据),这会带来更好的用户体验。

Well, last I checked, animated gifs don't work in Flex unless you have a workaround. Still, I wouldn't use an animated gif to create an animation because of their low quality. I would just recreate it using Flash.

The way I would do the loader however would be very different. personally, I don't believe in 'system loaders' unless it's your application's preloader. The reason for this is that there could be more than one thing loading at the same time (which might not know about each other) which means that the loader popup could disappear before everything is loaded (first one loads, dispatches event and removes popup, while the other is still loading).

What I like to do is create a custom component for the popup loader (since it will be reused quite a bit) and from there I can either use states the are appropriate for my view or have a boolean flag binded to show the popup when true (this can easily be done using frameworks like Parsley). The popup would only cover the part of the system that's actually loading data (since I doubt that your whole app is loading data at the same time) which makes for a better UX.

难以启齿的温柔 2024-11-07 00:42:55

我最终使用了 as3gif (直到我可以将其重新创建为 .swf)。我这样做的方法是使用我的自定义事件类(AceEvent.SHOW_LOADER 和 AceEvent.HIDE_LOADER),它会冒泡到顶部。然后,我使用 PopUpManager 通过模式添加/删除它以禁用该应用程序。

I ended up using as3gif (until I can get this recreated as a .swf). The way I do this is by using my custom event class (AceEvent.SHOW_LOADER and AceEvent.HIDE_LOADER), which bubbles up to the top. I then use the PopUpManager to add/remove this with modal to disable the application.

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