Select to view content in your preferred language

What happened to CompositeSymbol after flex api 3.0?

988
4
06-18-2013 01:08 AM
AntonNovichikhin
Deactivated User
In the API version 3.0 I could create fillsymbol with markers at vertexes.
e.g.
<esri:CompositeSymbol id="fill">
[INDENT]<esri:SimpleFillSymbol alpha="0.2" color="0x000000" style="solid">
[INDENT]<esri:outline>
[INDENT]<esri:SimpleLineSymbol width="3" color="0x00FFCC"/>[/INDENT]
</esri:outline>[/INDENT]    
</esri:SimpleFillSymbol>
<esri:SimpleMarkerSymbol color="0x00EEBB" size="12" style="circle"/>[/INDENT]
</esri:CompositeSymbol>

[ATTACH=CONFIG]25328[/ATTACH]
after changing the library to 3.3 version application when I try to add a polygon graphics with such a symbol to a graphics layer application fails with the error:
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at com.esri.ags.symbols::SimpleMarkerSymbol/draw()
at com.esri.ags.symbols::CompositeSymbol/draw()
at com.esri.ags::Graphic/http://www.esri.com/2008/ags/internal::drawWithSymbol()
at com.esri.ags::Graphic/commitProperties()
at mx.core::UIComponent/validateProperties()
at mx.managers::LayoutManager/validateProperties()
at mx.managers::LayoutManager/doPhasedInstantiation()
at mx.managers::LayoutManager/doPhasedInstantiationCallback()


Composite line symbol just ignores the marker and draws without it, posting to console, but app is still alive:
TypeError: Error #1034: Type Coercion failed: cannot convert Object@185b8f71 to com.esri.ags.symbols.Symbol.
TypeError: Error #1034: Type Coercion failed: cannot convert Object@1bf2af41 to mx.styles.IAdvancedStyleClient.
TypeError: Error #1034: Type Coercion failed: cannot convert Object@1bf30731 to flash.geom.Transform.
TypeError: Error #2007: Parameter child must be non-null.
TypeError: Error #1034: Type Coercion failed: cannot convert Object@182c7fd1 to mx.managers.IFocusManager.
TypeError: Error #1034: Type Coercion failed: cannot convert Object@1bf2af41 to flash.display.DisplayObjectContainer.
TypeError: Error #1034: Type Coercion failed: cannot convert Object@1bf30c29 to flash.media.SoundTransform.
TypeError: Error #1034: Type Coercion failed: cannot convert Object@1bf30d49 to flash.accessibility.AccessibilityProperties.
TypeError: Error #1034: Type Coercion failed: cannot convert Object@1bf30731 to flash.geom.Transform.
TypeError: Error #1034: Type Coercion failed: cannot convert Object@1bd6a239 to com.esri.ags.symbols.Symbol.
TypeError: Error #1034: Type Coercion failed: cannot convert Object@1bf3ed19 to mx.styles.IAdvancedStyleClient.
TypeError: Error #1034: Type Coercion failed: cannot convert Object@1bd6a521 to flash.geom.Transform.
TypeError: Error #2007: Parameter child must be non-null.
TypeError: Error #1034: Type Coercion failed: cannot convert Object@182c7fd1 to mx.managers.IFocusManager.
TypeError: Error #1034: Type Coercion failed: cannot convert Object@1bf3ed19 to flash.display.DisplayObjectContainer.
TypeError: Error #1034: Type Coercion failed: cannot convert Object@1bd6aa01 to flash.media.SoundTransform.
TypeError: Error #1034: Type Coercion failed: cannot convert Object@1bd6ab21 to flash.accessibility.AccessibilityProperties.
TypeError: Error #1034: Type Coercion failed: cannot convert Object@1bd6a521 to flash.geom.Transform.
TypeError: Error #1034: Type Coercion failed: cannot convert Object@1bd6dd61 to com.esri.ags.symbols.Symbol.
TypeError: Error #1034: Type Coercion failed: cannot convert Object@1fe9d521 to flash.geom.Transform.
TypeError: Error #2007: Parameter child must be non-null.
TypeError: Error #1034: Type Coercion failed: cannot convert Object@1fe9d7f1 to flash.media.SoundTransform.
TypeError: Error #1034: Type Coercion failed: cannot convert Object@1fe9d911 to flash.accessibility.AccessibilityProperties.
TypeError: Error #1034: Type Coercion failed: cannot convert Object@1fe9d521 to flash.geom.Transform.
TypeError: Error #1034: Type Coercion failed: cannot convert Object@185b85f9 to mx.styles.IAdvancedStyleClient.
TypeError: Error #1034: Type Coercion failed: cannot convert Object@1fef1041 to flash.geom.Transform.
TypeError: Error #2007: Parameter child must be non-null.
TypeError: Error #1034: Type Coercion failed: cannot convert Object@182c7fd1 to mx.managers.IFocusManager.
TypeError: Error #1034: Type Coercion failed: cannot convert Object@185b85f9 to flash.display.DisplayObjectContainer.
TypeError: Error #1034: Type Coercion failed: cannot convert Object@1fef1521 to flash.media.SoundTransform.
TypeError: Error #1034: Type Coercion failed: cannot convert Object@1fef1641 to flash.accessibility.AccessibilityProperties.
TypeError: Error #1034: Type Coercion failed: cannot convert Object@1fef1041 to flash.geom.Transform.
TypeError: Error #1034: Type Coercion failed: cannot convert Object@1bd6dd61 to com.esri.ags.symbols.Symbol.
TypeError: Error #1034: Type Coercion failed: cannot convert Object@185b85f9 to mx.styles.IAdvancedStyleClient.
TypeError: Error #1034: Type Coercion failed: cannot convert Object@1fef1c29 to flash.geom.Transform.
TypeError: Error #2007: Parameter child must be non-null.
TypeError: Error #1034: Type Coercion failed: cannot convert Object@182c7fd1 to mx.managers.IFocusManager.
TypeError: Error #1034: Type Coercion failed: cannot convert Object@185b85f9 to flash.display.DisplayObjectContainer.
TypeError: Error #1034: Type Coercion failed: cannot convert Object@1fefa149 to flash.media.SoundTransform.
TypeError: Error #1034: Type Coercion failed: cannot convert Object@1fefa269 to flash.accessibility.AccessibilityProperties.
TypeError: Error #1034: Type Coercion failed: cannot convert Object@1fef1c29 to flash.geom.Transform.
TypeError: Error #1034: Type Coercion failed: cannot convert Object@186c1191 to com.esri.ags.symbols.Symbol.
TypeError: Error #1034: Type Coercion failed: cannot convert Object@185b85f9 to mx.styles.IAdvancedStyleClient.
TypeError: Error #1034: Type Coercion failed: cannot convert Object@1fefa8c9 to flash.geom.Transform.
TypeError: Error #2007: Parameter child must be non-null.
TypeError: Error #1034: Type Coercion failed: cannot convert Object@182c7fd1 to mx.managers.IFocusManager.
TypeError: Error #1034: Type Coercion failed: cannot convert Object@185b85f9 to flash.display.DisplayObjectContainer.
TypeError: Error #1034: Type Coercion failed: cannot convert Object@1fefada9 to flash.media.SoundTransform.
TypeError: Error #1034: Type Coercion failed: cannot convert Object@1fefaec9 to flash.accessibility.AccessibilityProperties.
TypeError: Error #1034: Type Coercion failed: cannot convert Object@1fefa8c9 to flash.geom.Transform.
TypeError: Error #1034: Type Coercion failed: cannot convert Object@185b8f71 to com.esri.ags.symbols.Symbol.
TypeError: Error #1034: Type Coercion failed: cannot convert Object@185b85f9 to mx.styles.IAdvancedStyleClient.
TypeError: Error #1034: Type Coercion failed: cannot convert Object@1fefd4f1 to flash.geom.Transform.
TypeError: Error #2007: Parameter child must be non-null.
TypeError: Error #1034: Type Coercion failed: cannot convert Object@182c7fd1 to mx.managers.IFocusManager.
TypeError: Error #1034: Type Coercion failed: cannot convert Object@185b85f9 to flash.display.DisplayObjectContainer.
TypeError: Error #1034: Type Coercion failed: cannot convert Object@1fefd9d1 to flash.media.SoundTransform.
TypeError: Error #1034: Type Coercion failed: cannot convert Object@1fefdaf1 to flash.accessibility.AccessibilityProperties.
TypeError: Error #1034: Type Coercion failed: cannot convert Object@1fefd4f1 to flash.geom.Transform.
TypeError: Error #1034: Type Coercion failed: cannot convert Object@1fe884d9 to com.esri.ags.symbols.Symbol.
TypeError: Error #1034: Type Coercion failed: cannot convert Object@185b85f9 to mx.styles.IAdvancedStyleClient.
TypeError: Error #1034: Type Coercion failed: cannot convert Object@1ff04149 to flash.geom.Transform.
TypeError: Error #2007: Parameter child must be non-null.
TypeError: Error #1034: Type Coercion failed: cannot convert Object@182c7fd1 to mx.managers.IFocusManager.
TypeError: Error #1034: Type Coercion failed: cannot convert Object@185b85f9 to flash.display.DisplayObjectContainer.
TypeError: Error #1034: Type Coercion failed: cannot convert Object@1ff04629 to flash.media.SoundTransform.
TypeError: Error #1034: Type Coercion failed: cannot convert Object@1ff04749 to flash.accessibility.AccessibilityProperties.
TypeError: Error #1034: Type Coercion failed: cannot convert Object@1ff04149 to flash.geom.Transform.


Any ideas?
Tags (2)
0 Kudos
4 Replies
RobertScheitlin__GISP
MVP Emeritus
Anton,

   Your issue must lie somewhere else in your code as this works fine for me. Here is a sample that does what you are attempting using the 3.3 API.

<?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"
               minWidth="955" minHeight="600"
               xmlns:esri="http://www.esri.com/2008/ags"
               creationComplete="init()">
    <fx:Script>
        <=!=[=C=D=A=T=A=[
            import com.esri.ags.Graphic;
            import com.esri.ags.geometry.MapPoint;
            import com.esri.ags.geometry.Polygon;
            import com.esri.ags.layers.GraphicsLayer;
            import com.esri.ags.symbols.SimpleFillSymbol;
            import com.esri.ags.symbols.SimpleLineSymbol;
            protected function init():void 
            {
                var sls:SimpleLineSymbol = new SimpleLineSymbol("solid",0x00ff00,1,1);
                var sfs:SimpleFillSymbol = new SimpleFillSymbol("solid", 0xff0000,1,sls);
                var gl:GraphicsLayer = new GraphicsLayer();
                gl.symbol =fill;
                map.addLayer(gl);
                var myPolygon:Polygon = new Polygon(
                    [[
                        new MapPoint(2352491, -1992338),
                        new MapPoint(2332923, -2461967),
                        new MapPoint(2646009, -2266288),
                        new MapPoint(3076503, -2324992),
                        new MapPoint(3272181, -2520670),
                        new MapPoint(3506996, -2559806),
                        new MapPoint(3702675, -3049003),
                        new MapPoint(3370021, -3675175),
                        new MapPoint(2763416, -4046965),
                        new MapPoint(2117676, -4144804),
                        new MapPoint(1961133, -3890422),
                        new MapPoint(2000269, -3655607),
                        new MapPoint(1667615, -3185978),
                        new MapPoint(1550208, -2422831),
                        new MapPoint(1334961, -1953202),
                        new MapPoint(2352491, -1992338)
                    ]], new SpatialReference(102100));
                var myGraphicPolygon:Graphic = new Graphic();
                myGraphicPolygon.geometry = myPolygon;
                gl.add(myGraphicPolygon);
            }
        ]=]=>
    </fx:Script>
    <fx:Declarations>
        <esri:Extent id="initialExtent"
                     xmin="-509000" ymin="-4924000" xmax="5753000" ymax="-1025000">
            <esri:SpatialReference wkid="102100"/>
        </esri:Extent>
        <esri:CompositeSymbol id="fill">
            <esri:SimpleFillSymbol id="sfs" color="0xcccccc" alpha="1">
                <esri:SimpleLineSymbol alpha="1" color="0x01eebb" width="2" style="solid" />
            </esri:SimpleFillSymbol>
            <esri:SimpleMarkerSymbol id="sms" style="circle" size="10" alpha="1" angle="0" color="0x01eebb" />
        </esri:CompositeSymbol>
    </fx:Declarations>
    <esri:Map extent="{initialExtent}" id="map">
        <esri:ArcGISTiledMapServiceLayer url="http://server.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer"/>
    </esri:Map>
</s:Application>
0 Kudos
JoeHewitt
Regular Contributor
I had a similiar problem when trying to pass a CompositeSymbol that contained a MarkerSymbol to a polygon graphics, almost like the polygon does not know what to do with the MarkerSymbol because that's for point graphics and it is a polygon graphic.

Are you setting the Mappoints manually like in Roberts example, or are you just pulling the graphics directly from a layer?
0 Kudos
AntonNovichikhin
Deactivated User
almost like the polygon does not know what to do with the MarkerSymbol because that's for point graphics and it is a polygon graphic.

flex documentation says that it should work similar to Cartographic Representations in ArcMap when your are able to symbolize elements of feature (vertices, outline, fill) with a symbol matched to their actual geometry


Are you setting the Mappoints manually like in Roberts example, or are you just pulling the graphics directly from a layer?

no. I'm getting a response from Identify or Find tasks and then add graphics to graphics layer.
0 Kudos
AntonNovichikhin
Deactivated User
Anton,
   Your issue must lie somewhere else in your code as this works fine for me. Here is a sample that does what you are attempting using the 3.3 API.

thanks for the test. i'll try to inspect whole graphic generation process in code.
0 Kudos