我怎样才能“预加载” FLEX 3.5 TabNavigator 选项卡中的 Google Maps API?
我有一个 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我在使用雅虎时遇到了同样的问题!地图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).