Using Flex API 1.3...
Based on posts from the previous forum, I wrote the following function to convert a map graphic to a swatch and add it to an InfoWindow:
function createSwatchFromGraphic(g:Graphic,m:Map):UIComponent {
var swatch:UIComponent = new UIComponent;
var sym:Symbol = g.symbol;
sym.draw(swatch, new MapPoint(), null, m);
swatch.x = swatch.y = 0;
return swatch;
}
I use this for point markers; this function has worked great for simple markers and composite markers. However, it chokes on picture markers at the sym.draw function with a type coercion error - can't convert UIComponent to Graphic.
So I thought since the symbol apparently is a UIComponent, I could cast the symbol as a picture marker symbol, transfer its height and width properties to the sprite, set the sprite's x/y to 0, and add the symbol as a child of the sprite...yeah, that didn't work either (null pointer exception when the child was added to the swatch).
Any wisdom to impart?