Select to view content in your preferred language

Could not resolve <s:controlBarContent> to a component implementation ...Urgent Help

1787
8
06-01-2011 07:58 AM
by Anonymous User
Not applicable
Original User: sravabonagiri

Hi Flex Gurus,

I need a small favor. I am working on a dropdown control and zoom to feature (point) for a beach application. I was able to implement the attached code alright for a standalone application. But, When I am adding the code as a custom widget to my existing code....I am getting the following error. That is, Could not resolve <s:controlBarContent> to a component implementation. I attached the code as well as error image here. Could you please help me fix the issue. Please let me know if you need further information. Many thanks for your help.

Thanks,
Sam
0 Kudos
8 Replies
by Anonymous User
Not applicable
Original User: rscheitlin

Sam,

Here is what you have so far fixed:

<?xml version="1.0" encoding="utf-8"?>
<!--
////////////////////////////////////////////////////////////////////////////////
//
// Copyright (c) 2010 ESRI
//
// All rights reserved under the copyright laws of the United States.
// You may freely redistribute and use this software, with or
// without modification, provided you include the original copyright
// and use restrictions.  See use restrictions in the file:
// <install location>/License.txt
//
////////////////////////////////////////////////////////////////////////////////
-->
<viewer:BaseWidget 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:esri="http://www.esri.com/2008/ags"
       xmlns:custom="components.*"  
       xmlns:viewer="com.esri.viewer.*"
       widgetConfigLoaded="init()">
 
 <fx:Declarations>
  <esri:QueryTask id="queryTask"
      executeComplete="queryTask_executeCompleteHandler(event)"
      showBusyCursor="true"
      url="http://167.193.56.180/ArcGIS/rest/services/Georgia_Beach/MapServer/0"
      useAMF="false"/>
 </fx:Declarations>
 
 <fx:Script>
  <![CDATA[
   import com.esri.ags.Graphic;
   import com.esri.ags.events.MapEvent;
   import com.esri.ags.events.QueryEvent;
   import com.esri.ags.geometry.Extent;
   import com.esri.ags.geometry.Geometry;
   import com.esri.ags.geometry.MapPoint;
   import com.esri.ags.tasks.supportClasses.Query;
   import com.esri.ags.utils.GraphicUtil;
   
   import mx.collections.ArrayCollection;
   import mx.collections.ArrayList;
   
   import spark.events.IndexChangeEvent;
   
   protected function init():void
   {
    var query:Query = new Query();
    query.outFields = [ "NAME_1" ];
    query.outSpatialReference = map.spatialReference;
    query.returnGeometry = true;
    query.where = "1=1";
    queryTask.execute(query);
   }
   
   protected function queryTask_executeCompleteHandler(event:QueryEvent):void
   {
    ddList.dataProvider = new ArrayList(event.featureSet.features);
   }
   
   protected function ddListLabelFunction(item:Graphic):String
   {
    return item.attributes["NAME_1"];
   }
   
   protected function ddList_changeHandler(event:IndexChangeEvent):void
   { 
    var pt:MapPoint = MapPoint(Graphic(ddList.selectedItem).geometry);
    var beachExtent:Extent = new Extent(pt.x - 100, pt.y -100, pt.x + 100, pt.y + 100);
    map.extent = beachExtent 
    
    // make sure the whole extent is visible
    if (!map.extent.contains(beachExtent))
    {
     map.level--;
    } 
   }
  ]]>                
 </fx:Script>
 
 <viewer:WidgetTemplate id="DropDown" width="300" height="200" > 
  <viewer:layout>
   <s:HorizontalLayout horizontalAlign="center" verticalAlign="middle"/>
  </viewer:layout>
   <s:DropDownList id="ddList"
       width="200"
       change="ddList_changeHandler(event)"
       labelFunction="ddListLabelFunction"
       prompt="Choose a beach..."/>
 </viewer:WidgetTemplate>
</viewer:BaseWidget>
0 Kudos
ShravanBonagiri
New Contributor
Hi Robert,

Thanks for your help. I appreciate it. I was able to get past that error. But, I have another issue facing me. That is, call to a undefined method query. I attached the error file. The error is showing up in init() function for method Query. Your help is appreciated.
0 Kudos
by Anonymous User
Not applicable
Original User: rscheitlin

Sam,

   What ESRI Flex API version are you using?
0 Kudos
ShravanBonagiri
New Contributor
Robert,

I am using agslib-2.3.1-2011-04-26.
0 Kudos
by Anonymous User
Not applicable
Original User: rscheitlin

Sam,

   The issue I am having is that because the code already has:
import com.esri.ags.tasks.supportClasses.Query;

There is no reason for that error if you are using agslib-2.3.1-2011-04-26...:confused:
0 Kudos
ShravanBonagiri
New Contributor
Ok. Thanks for your continued support. I am new to Flex development. Previously, I was working with Silverlight API. I hear some compatibility issues with Flash Builder 4.5. Should I go back to Flash Builder 4.0?

Thanks,
Sam
0 Kudos
by Anonymous User
Not applicable
Original User: rscheitlin

Sam,

   No that is not the issue because I build the exact code I sent you using Flash Builder 4.5 and the 4.5 SDK as well.  See what happens when you fully qualify the query in the init function.

protected function init():void
   {
    var query:com.esri.ags.tasks.supportClasses.Query = new com.esri.ags.tasks.supportClasses.Query();
    query.outFields = [ "NAME_1" ];
    query.outSpatialReference = map.spatialReference;
    query.returnGeometry = true;
    query.where = "1=1";
    queryTask.execute(query);
   }
0 Kudos
ShravanBonagiri
New Contributor
Excellent. It did the trick. Thanks for persisting with me. Thanks a ton.
0 Kudos