【问题标题】:TypeError: Error #1034: Type Coercion failed: cannot convert views::AGISHomeView@6396ae1 to spark.components.ViewTypeError:错误#1034:类型强制失败:无法将视图::AGISHomeView@6396ae1 转换为 spark.components.View
【发布时间】:2014-08-28 07:38:14
【问题描述】:

我是 flex 和 Flash builder 的新手,我按照此链接中的教程:Query your data 编写了一个包含查询任务的移动地图应用程序,编写代码后,问题选项卡中没有出现错误,但是有是 6 个警告,并且在运行应用程序时出现以下错误:

发生了 ActionScript 错误:

TypeError: Error #1034: Type Coercion failed: cannot convert views::AGISHomeView@6396ae1 to spark.components.View.
at spark.components::ViewNavigator/createViewInstance()[E:\dev\4.y\frameworks\projects\mobilecomponents\src\spark\components\ViewNavigator.as:1999]
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:783]
at mx.managers::LayoutManager/doPhasedInstantiationCallback()[E:\dev\4.y\frameworks\projects\framework\src\mx\managers\LayoutManager.as:1180]”

感谢任何形式的帮助。

哈尼,


这是我使用的代码:

<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
                     xmlns:s="library://ns.adobe.com/flex/spark"
                     xmlns:mx="library://ns.adobe.com/flex/mx"
                     xmlns="http://ns.adobe.com/air/application/4.6"
                     xmlns:esri="http://www.esri.com/2008/ags">

      <s:layout>
            <s:VerticalLayout gap="10"
                                      horizontalAlign="center"
                                      paddingBottom="20"
                                      paddingLeft="25"
                                      paddingRight="25"
                                      paddingTop="20"/>
      </s:layout>
      <fx:Script>
            <![CDATA[
                  import com.esri.ags.FeatureSet;
                  import mx.controls.Alert;
                  import mx.rpc.AsyncResponder;

                  private function doQuery():void
                  {
                        queryTask.execute(query, new AsyncResponder(onResult, onFault));

                        function onResult(featureSet:FeatureSet, token:Object = null):void
                        {
                              // No code needed in this simple sample, since the
                              // graphics layer is bound to the query result using
                              // graphicProvider="{queryTask.executeLastResult.features}"
                        }

                        function onFault(info:Object, token:Object = null):void
                        {
                              Alert.show(info.toString(), "Query Problem");
                        }
                  }
            ]]>
      </fx:Script>
      <fx:Declarations>
            <!-- Layer with US States -->
            <esri:QueryTask id="queryTask"
                                    showBusyCursor="true"
                                    url="http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Demographics/ESRI_Census_USA/MapServer/5"
                                    useAMF="false"/>
            <esri:Query id="query"
                              outSpatialReference="{myMap.spatialReference}"
                              returnGeometry="true"
                              text="{qText.text}">

                  <esri:outFields>
                        <fx:String>MED_AGE</fx:String>
                        <fx:String>POP2007</fx:String>
                  </esri:outFields>
            </esri:Query>

      </fx:Declarations>   
      <s:Panel height="60"
                   backgroundColor="0xB2BFC6"
                   title="Query a layer (search for a state)">

            <s:layout>
                  <s:HorizontalLayout/>
            </s:layout>

            <s:TextInput id="qText"
                               width="100%"
                               enter="doQuery()"
                               text="California"/>

            <s:Button click="doQuery()" label="Do Query"/>
      </s:Panel>
      <esri:Map id="myMap">
            <esri:extent>
                  <esri:Extent xmin="-14298000" ymin="2748000" xmax="-6815000" ymax="7117000">
                        <esri:SpatialReference wkid="102100"/>
                  </esri:Extent>
            </esri:extent>

            <esri:ArcGISTiledMapServiceLayer
                  url="http://server.arcgisonline.com/ArcGIS/rest/services/World_Physical_Map/MapServer"/>

      </esri:Map>
</s:Application>
_______________________________________________________________

【问题讨论】:

  • 能否展示views.AGISHomeView的代码及其用法?

标签: actionscript-3 flash apache-flex arcgis flex4.6


【解决方案1】:

我尝试了您的代码,它对我来说运行良好,没有任何警告。你能说明你得到的警告是什么吗?我认为这些应该与皮肤有关,您必须更改 RSL 设置以使其正常工作。 将 Arcgis.swc 的 RSL 设置更改为“外部”

【讨论】:

    猜你喜欢
    • 2012-09-04
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-10-21
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多