Openscales 2.2空对象参考

时间:2012-12-04 12:18:55

标签: actionscript-3 flash mobile openstreetmap

我使用Flash Builder 4.6和openscales 2.2构建了一个移动应用程序

我使用了openscales 1.2.1并且它工作正常,但它非常慢并且缩放效果不好。

所以我想升级到openscales 2.2。 我将.swc添加到我的libs文件夹中,然后将FeatureLayer更改为VectorLayer,因为这是在新版本中重命名的。

如果我测试应用程序,调试器会给我以下错误:

TypeError: Error #1009: Cannot access a property or method of a null object reference.
    at org.openscales.core::Map()[D:\workspace\openscales\target\checkout\openscales-core\src\main\flex\org\openscales\core\Map.as:296]
    at org.openscales.fx::FxMap()[D:\workspace\openscales\target\checkout\openscales-fx\src\main\flex\org\openscales\fx\FxMap.as:70]
    at views::mapView/_mapView_FxMap1_i()
    at views::mapView/_mapView_Array1_c()
    at mx.core::DeferredInstanceFromFunction/getInstance()[E:\dev\4.y\frameworks\projects\framework\src\mx\core\DeferredInstanceFromFunction.as:108]
    at spark.components::SkinnableContainer/createDeferredContent()[E:\dev\4.y\frameworks\projects\spark\src\spark\components\SkinnableContainer.as:1049]
    at spark.components::SkinnableContainer/createContentIfNeeded()[E:\dev\4.y\frameworks\projects\spark\src\spark\components\SkinnableContainer.as:1078]
    at spark.components::SkinnableContainer/createChildren()[E:\dev\4.y\frameworks\projects\spark\src\spark\components\SkinnableContainer.as:885]
    at mx.core::UIComponent/initialize()[E:\dev\4.y\frameworks\projects\framework\src\mx\core\UIComponent.as:7634]
    at spark.components::View/initialize()[E:\dev\4.y\frameworks\projects\mobilecomponents\src\spark\components\View.as:999]
    at views::mapView/initialize()
    at mx.core::UIComponent/http://www.adobe.com/2006/flex/mx/internal::childAdded()[E:\dev\4.y\frameworks\projects\framework\src\mx\core\UIComponent.as:7495]
    at mx.core::UIComponent/addChildAt()[E:\dev\4.y\frameworks\projects\framework\src\mx\core\UIComponent.as:7199]
    at spark.components::Group/addDisplayObjectToDisplayList()[E:\dev\4.y\frameworks\projects\spark\src\spark\components\Group.as:2037]
    at spark.components::Group/http://www.adobe.com/2006/flex/mx/internal::elementAdded()[E:\dev\4.y\frameworks\projects\spark\src\spark\components\Group.as:1628]
    at spark.components::Group/addElementAt()[E:\dev\4.y\frameworks\projects\spark\src\spark\components\Group.as:1387]
    at spark.components::Group/addElement()[E:\dev\4.y\frameworks\projects\spark\src\spark\components\Group.as:1345]
    at spark.components::SkinnableContainer/addElement()[E:\dev\4.y\frameworks\projects\spark\src\spark\components\SkinnableContainer.as:761]
    at spark.components::ViewNavigator/createViewInstance()[E:\dev\4.y\frameworks\projects\mobilecomponents\src\spark\components\ViewNavigator.as:2018]
    at spark.components::ViewNavigator/commitNavigatorAction()[E:\dev\4.y\frameworks\projects\mobilecomponents\src\spark\components\ViewNavigator.as:1932]
    at spark.components::ViewNavigator/commitProperties()[E:\dev\4.y\frameworks\projects\mobilecomponents\src\spark\components\ViewNavigator.as:1301]
    at mx.core::UIComponent/validateProperties()[E:\dev\4.y\frameworks\projects\framework\src\mx\core\UIComponent.as:8219]
    at mx.managers::LayoutManager/validateProperties()[E:\dev\4.y\frameworks\projects\framework\src\mx\managers\LayoutManager.as:597]
    at mx.managers::LayoutManager/doPhasedInstantiation()[E:\dev\4.y\frameworks\projects\framework\src\mx\managers\LayoutManager.as:813]
    at mx.managers::LayoutManager/doPhasedInstantiationCallback()[E:\dev\4.y\frameworks\projects\framework\src\mx\managers\LayoutManager.as:1180]

d:\工作空间\ openscales \目标\结帐\ openscales核\ SRC \主\柔性\有机\ openscales \核心\ Map.as:296] 这条线真的很奇怪,因为我的电脑上没有这个文件夹因为我觉得opencales的.swc中有错误的路径?

祝你好运 雅尼娜

1 个答案:

答案 0 :(得分:0)

我有同样的问题,我在我的Mac上使用错误的Windows路径ORZ创建了项目.... 但是在阅读源代码后问题已经解决了。 在名为“org.openscales.core.Map.as”的类文件中,大约是第300行。

var menu:ContextMenu = new ContextMenu();
menu.hideBuiltInItems();

var notice:ContextMenuItem = new ContextMenuItem("Powered by OpenScales");
notice.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT, openLink);
menu.customItems.push(notice);
contextMenu = menu;

航空移动应用程序不支持contextMenu。所以,只需评论它们并重建opencales lib.Good luck。