Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

Trying to compile (in 3.0) an ArcGIS Flexviewer widget that was created in v2.4 of the AGS api for flex, and receive a UniqueValueRenderer error as follows. Code is below also.

Encountered errors or warnings while building project DriveTimeWidget.mxml. DriveTimeWidget.mxml: Cannot resolve attribute 'attribute' for component type com.esri.ags.renderers.UniqueValueRenderer.

        import mx.controls.Alert;
        import mx.rpc.AsyncResponder;

        private var myGraphicsLayer:GraphicsLayer = new GraphicsLayer(); 
        [Bindable]
        private var url:String;
        [Bindable]
        private var driveTimes:String;
        [Bindable]
        private var driveTimeAlpha:Number;
        [Bindable]
        private var driveTimesArray:Array;
        [Bindable]
        private var driveTime1:String;
        [Bindable] 
        private var driveTime2:String;
        [Bindable]
        private var driveTime3:String;
        [Bindable]
        private var ring1color:uint;
        [Bindable]
        private var ring2color:uint;
        [Bindable]
        private var ring3color:uint;


        //this function called when the widget's configuration is loaded
        private function init():void
        {
            if (configXML) // checking for valid content in the configuration file
            {
                url = configXML.url;
                map.addLayer(myGraphicsLayer);  
                driveTimes = configXML.driveTimes;
                driveTimeAlpha = configXML.alpha;
                ring1color = configXML.ring1color;
                ring2color = configXML.ring2color;
                ring3color = configXML.ring3color;
            }
            driveTimesArray = driveTimes.split(" ");
            driveTime1 = driveTimesArray[0];
            driveTime2 = driveTimesArray[1];
            driveTime3 = driveTimesArray[2];
        }
        private function computeServiceArea(mapPoint:MapPoint):void
        {
            myGraphicsLayer.clear();
            var graphic:Graphic = new Graphic(mapPoint, sms_circleAlphaSizeOutline);
            myGraphicsLayer.add(graphic);
            var featureSet:FeatureSet = new FeatureSet([ graphic ]);
            var params:Object =
                {
                    "Input_Location": featureSet,
                    "Drive_Times": driveTimes
                };
            gp.execute(params, new AsyncResponder(onResult, onFault));
            function onResult(gpResult:ExecuteResult,token:Object = null):void
            {
                var pv:ParameterValue = gpResult.results[0];
                var fs:FeatureSet = pv.value as FeatureSet;
                myGraphicsLayer.graphicProvider = fs.features;
                myGraphicsLayer.renderer=uniqueValueRenderer;
            }
            function onFault(info:Object, token:Object = null):void
            {
                Alert.show(info.toString());
            }
        }
        private function clear():void
        {
            myGraphicsLayer.clear();
        }

        private function mapClickHandler(event:MapMouseEvent):void
        {
            computeServiceArea(event.mapPoint);
        }

        protected function driveTime_openHandler(event:Event):void
        {
            map.addEventListener(MapMouseEvent.MAP_CLICK,mapClickHandler)               
        }



        protected function driveTime_closedHandler(event:Event):void
        {
            map.removeLayer(myGraphicsLayer);   
            map.removeEventListener(MapMouseEvent.MAP_CLICK,mapClickHandler)    
        }

    ]]>
</fx:Script>


<fx:Declarations>

    <esri:SimpleMarkerSymbol id="sms_circleAlphaSizeOutline"
                             alpha="0.5"
                             size="15"
                             style="circle"/>

    <esri:SimpleFillSymbol id="rFill"
                           alpha="{driveTimeAlpha}"
                           color="{ring1color}"/>
    <esri:SimpleFillSymbol id="gFill"
                           alpha="{driveTimeAlpha}"
                           color="{ring2color}"/>
    <esri:SimpleFillSymbol id="bFill"
                           alpha="{driveTimeAlpha}"
                           color="{ring3color}"/>

    <esri:UniqueValueRenderer id="uniqueValueRenderer" attribute="ToBreak">
        <esri:UniqueValueInfo symbol="{rFill}" value="{driveTime1}"/>
        <esri:UniqueValueInfo symbol="{gFill}" value="{driveTime2}"/>
        <esri:UniqueValueInfo symbol="{bFill}" value="{driveTime3}"/>
    </esri:UniqueValueRenderer>



    <esri:Geoprocessor id="gp"
                       outSpatialReference="{map.spatialReference}"
                       url="http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Network/ESRI_DriveTime_US/GPServer/CreateDriveTimePolygons"
                       useAMF="false"/>

</fx:Declarations>


<viewer:WidgetTemplate id= "driveTime"
                       width="380" 
                       height="100" 
                       open="driveTime_openHandler(event)"
                       closed="driveTime_closedHandler(event)"

                     >

    <s:VGroup width="100%" height="100%">
        <s:Label text="This Widget Calculates DriveTimes (3, 5, 7 minutes)"/>

        <s:HGroup width="100%"
                  paddingLeft="5"
                  paddingBottom="2"
                  paddingTop="2" verticalAlign="middle" styleName="">



        </s:HGroup>
    </s:VGroup>
</viewer:WidgetTemplate>

share|improve this question

1 Answer 1

This has been resolved....changed from:

<esri:UniqueValueRenderer id="uniqueValueRenderer" attribute="ToBreak">

to

<esri:UniqueValueRenderer id="uniqueValueRenderer" field="ToBreak">
share|improve this answer
2  
For this and more information on migrating from Flex API code from 2.x to 3.0, see the migration steps at resources.arcgis.com/en/help/flex-api/concepts/index.html#/… –  Bjorn Svensson Jul 2 '12 at 16:31

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.