我怎样才能“预加载” FLEX 3.5 TabNavigator 选项卡中的 Google Maps API?

发布于 2024-08-31 09:04:45 字数 653 浏览 6 评论 0原文

我有一个 Flex 3.5 Air 应用程序;除了标题之外,主窗口还有一个 TabNavigator。在选项卡中,我放置了一个 Google 地图对象。它工作正常,除了它“加载”非常慢并且整个应用程序冻结(没有响应问题)。

现在我想解决这个问题,但现在不知道如何实施这些解决方案之一: 1) 在整个应用程序加载之前加载API。 2) 单击选项卡时以某种方式异步加载 API。我真的不需要一个花哨的预加载器,只要我的应用程序不会冻结就足够了。

请注意,我“110%”确定这是 GoogleMaps 的错误,因为选项卡画布是空的,并且没有其他代码[仔细检查]。另请注意,地图仅加载,然后我调用 setCenter 方法,因此没有其他操作可以冻结它。

编辑:我设法确定不是 Api 对象创建很慢,而是它在 GUI 上的实际显示很慢。这是代码行。 ResellersMapClass 仅扩展了 Google Maps API 类,因为我打算添加额外的功能。但现在已经干净了。

this.map = new ResellersMapClass();
//between here
this.mapContainer.addChild( this.map  );
//and here

现在有办法预加载吗?或者任何其他可以防止 GUI 冻结的解决方案。

谢谢, 加布里埃尔

I have a Flex 3.5 Air Application; The main window has, besides the header, a TabNavigator. In a Tab, I've put a Google Maps object. It works fine, except that it "loads" very slow and the whole application freezes ( not responding problem ).

Now I would like to fix that but don't really now how to implement one of these solutions:
1) Load the API before the whole application loads.
2) Load the API somehow async, when the tab is clicked. I don't really need a fancy preloader, it's enough that my app doesn't freeze.

Please note that I'm "110%" sure that it's the GoogleMaps's fault since the tab canvas is empty, and no other code is there [double checked that]. Also please note that the map only loads, then I call the setCenter method, so no other operations that could freeze it.

EDIT: I managed to determine that not the Api Object creation is slow, but the actual display of it on the GUI. Here's the line of code. ResellersMapClass only extends the Google Maps API class since I intend to add there extra functionality. But right now is clean.

this.map = new ResellersMapClass();
//between here
this.mapContainer.addChild( this.map  );
//and here

Now is there a way to preload this ? Or any other solution that will prevent the GUI from freezing.

Thanks,
Gabriel

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

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

发布评论

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

评论(1

欢你一世 2024-09-07 09:04:45

我在使用雅虎时遇到了同样的问题!地图API。我最终只是将它放入一个模块中,并为它提供了一个用于加载的进度条。这至少应该有助于解决异步问题。如果问题是库中的繁重算法,则在闪存推出真正的多线程之前没有办法解决这个问题(交叉手指)。

I had the same problem with the Yahoo! map API. I ended up just dropping it in a module and gave it a ProgressBar for the load. That should help with the async issues at least. If the problem is a heavy algorithm in the library, there is no way around that until flash rolls out true multi-threading (crosses fingers).

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